<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Fantastic, thanks to both of you. I merged it here:<div class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0089-rename-string-reflection-init.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0089-rename-string-reflection-init.md</a></div><div class=""><br class=""></div><div class="">Please let me know if you’d like any other changes, I’ll kick off the review on Tuesday.</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""><div style=""><blockquote type="cite" class=""><div class="">On May 28, 2016, at 3:33 PM, Brent Royal-Gordon <<a href="mailto:brent@architechies.com" class="">brent@architechies.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote type="cite" class="">If anyone is curious, the revised proposal can be found here: <a href="https://github.com/austinzheng/swift-evolution/blob/2b31df6163f5c5d1975a37e72c6996b82d61a5c6/proposals/0089-rename-string-reflection-init.md" class="">https://github.com/austinzheng/swift-evolution/blob/2b31df6163f5c5d1975a37e72c6996b82d61a5c6/proposals/0089-rename-string-reflection-init.md</a><br class=""></blockquote><br class="">This is great. My only suggestion is that `init?(description: String)` should be `init?(_ description: String)`, since by definition the conversion is fullwidth. But you may already be planning to incorporate that change, since Chris mentioned it.<br class=""><br class="">Just quickly scanning the docs on <a href="http://swiftdoc.org" class="">swiftdoc.org</a>, here are protocols which I think should conform to LosslessStringConvertible:<br class=""><br class="">* FloatingPoint<br class="">* Integer<br class="">* Boolean?<br class=""><br class="">And here are concrete types:<br class=""><br class="">* Bool (if not Boolean)<br class="">* Character<br class="">* String (kind of circular, but I think it's a good idea) and its views<br class="">* String.Index? (Not sure how to represent this; UTF-8 offset, maybe?)<br class="">* UnicodeScalar<br class=""><br class="">Protocols which would require conditional conformances:<br class=""><br class="">* RangeReplaceableCollection where Iterator.Element == Character or UnicodeScalar<br class="">* SetAlgebra where Iterator.Element == Character or UnicodeScalar<br class=""><br class="">These protocols were chosen because they include `init<S: Sequence where S.Iterator.Element == Iterator.Element>(_: S)` initializers.<br class=""><br class="">Generic types which would require conditional conformances:<br class=""><br class="">* ClosedRange where Bound: LosslessStringConvertible<br class="">* CountableClosedRange where Bound: LosslessStringConvertible<br class="">* CountableRange where Bound: LosslessStringConvertible<br class="">* Range where Bound: LosslessStringConvertible<br class=""><br class="">These would be non-trivial, but useful. They could have a serialization like:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>var description: String {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>let operator = "..<"<span class="Apple-tab-span" style="white-space:pre">        </span>// or "..." for the closed ranges<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>func escape(_ string: String) -> String {<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>let escapedOperator = String(operator.characters.flatMap { ["\\", $0] })<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>return string.replacingOccurrences(of: "\\", with: "\\\\").replacingOccurrences(of: operator, with: escapedOperator)<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>}<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">        </span>return escape(String(lowerBound)) + " " + operator + " " + escape(String(upperBound))<br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}<br class=""><br class="">The `init(_: String)` method would need to handle the escapes—hence the nontrivial-ness.<br class=""><br class="">Technically possible, but probably unwise:<br class=""><br class="">* ObjectIdentifier<br class="">* UnsafePointer and friends<br class="">* Set.Index and Dictionary.Index<br class=""><br class="">-- <br class="">Brent Royal-Gordon<br class="">Architechies<br class=""><br class=""></div></div></blockquote></div><br class=""></div></body></html>