[swift-evolution] [Review #2] SE-0089: Renaming String.init<T>(_: T)
Ben Rimmington
me at benrimmington.com
Sat Jun 4 21:46:14 CDT 2016
<https://github.com/apple/swift-evolution/blob/master/proposals/
0089-rename-string-reflection-init.md>
Instead of LosslessStringConvertible, could the existing Streamable be used?
extension String {
public init<T : Streamable>(_ streamable: T) {
self.init()
streamable.write(to: &self)
}
}
AFAIK, only three types (UnicodeScalar, Character, String) are streamable.
But other types could add conformance; otherwise why does Streamable exist?
Streamable could be renamed to OutputStreamable, so that InputStreamable
can be added later.
-- Ben
More information about the swift-evolution
mailing list