<div dir="ltr">Agree. The approved text of SE-0089 explicitly contemplates Int conforming to LosslessStringConvertible. This would mean that it's a bug that the conformance hasn't been implemented.<div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 25, 2017 at 8:03 PM, Angelo Villegas via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div name="messageBodySection">I think this is a bug. Basing on other numeric types, the intended result would be the same for Int.</div><div><div class="h5">
<div name="messageReplySection"><br>
On 26 Jul 2017, 7:40 AM +0800, Niels Andriesse via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>>, wrote:<br>
<blockquote type="cite">
<div>I'm +1 on this.</div>
<div><br>
<div class="gmail_quote">
<div>On Mon, 24 Jul 2017 at 15:37 Niels Andriesse via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>And <font face="monospace, monospace">CustomStringConvertible</font><font face="arial, helvetica, sans-serif"> (to String) is basically the inverse of</font> <font face="monospace, monospace">LosslessStringConvertible</font> <font face="arial, helvetica, sans-serif">(from String).</font></div>
<div class="gmail_extra">
<div class="gmail_quote">On Mon, Jul 24, 2017 at 3:23 PM, Niels Andriesse <span><<a href="mailto:andriesseniels@gmail.com" target="_blank">andriesseniels@gmail.com</a>></span> wrote:<br></div>
</div>
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Just want to point out that conforming <font face="monospace, monospace">Int</font><font face="arial, helvetica, sans-serif"> to</font> <font face="monospace, monospace">LosslessStringConvertible</font><font face="arial, helvetica, sans-serif"> like this would mean assuming a radix of 10 in the implementation. That said, this would be consistent with the way </font><font face="monospace, monospace">Int</font> <font face="arial, helvetica, sans-serif">implements </font><font face="monospace, monospace">CustomStringConvert<wbr>ible</font><font face="arial, helvetica, sans-serif">, which also uses a radix of 10.</font></div>
<div class="gmail_extra"><br>
<div class="gmail_quote">
<div>
<div class="m_-4518517058137005375m_-4400418474714830553m_-412286965437656225h5">On Mon, Jul 24, 2017 at 4:36 AM, David Sweeris via swift-evolution <span><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br></div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div class="m_-4518517058137005375m_-4400418474714830553m_-412286965437656225h5">
<div dir="auto"><span></span>
<div><span><br></span></div>
<div><span>On Jul 23, 2017, at 09:15, Matheus Martins via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
<br></span></div>
<blockquote type="cite"><span></span>
<div><span></span>
<div><span></span>
<div><span>I came across what i think is an inconsistency in the standard library.</span></div>
<div><span><br></span></div>
<div><span>Why are some numeric types like Int not conforming to LosslessStringConvertible by default while Float and Double do conform to it in the standard library?</span></div>
<div><span><br></span></div>
<div><span>I came across this while trying to write some generic code:</span></div>
<div><span><br></span></div>
<div><span></span>
<div><span>func array<T: LosslessStringConvertible>(_ text: String) -> [T?] {</span></div>
<div><span><span class="m_-4518517058137005375m_-4400418474714830553m_-412286965437656225m_5510885133438737253m_549651671855291146gmail-Apple-tab-span" style="white-space:pre-wrap"></span>return text.components(separatedBy: " ").map { T($0) }</span></div>
<div>}</div>
</div>
<div><br></div>
<div>It seems rather inconsistent to me that that allows me to do:</div>
<div><br></div>
<div>let floats: [Float] = array("1.0 2.2 3")</div>
<div><br></div>
<div>but i can't do:</div>
<div><br></div>
<div>let ints: [Int] = array("1 2 3 4 5 6")</div>
<div>"<span style="color:rgb(255,255,255);font-family:Inconsolata,Monaco,Menlo,'Ubuntu Mono',Consolas,source-code-pro,monospace;font-size:13px;background-color:rgb(38,74,96)">type 'Int' does not conform to protocol 'LosslessStringConvertible'</span>"</div>
<div><br></div>
<div>To further my point, Int is used as the sole example in the LosslessStringConvertible docs: <a href="http://swiftdoc.org/v3.0/protocol/LosslessStringConvertible/" target="_blank">http://swiftdoc.org/v3.0/<wbr>protocol/<wbr>LosslessStringConvertible/</a></div>
<div>Yet it does not actually conform to it.</div>
<div><br></div>
<div>This seems way too basic for me to feel comfortable pitching it here, but i searched and couldn't find any discussion on this on any mailing list or website.</div>
</div>
</div>
</blockquote>
<br>
<div>Sounds like it's a bug to me, either in the docs or stdlib, depending on the intended behavior. Although I doubt they would've used Int in the docs if they weren't intending Int to conform to it.</div>
<div><br></div>
<div>- Dave Sweeris</div>
</div>
<br></div>
</div>
______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote>
</div>
<br></div>
</blockquote>
</div>
</div>
______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br></blockquote>
</div>
</div>
______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br></blockquote>
</div>
</div></div></div>
<br>______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div></div>