<div>I&#39;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 &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; 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>&lt;<a href="mailto:andriesseniels@gmail.com" target="_blank">andriesseniels@gmail.com</a>&gt;</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">CustomStringConvertible</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_-4400418474714830553m_-412286965437656225h5">On Mon, Jul 24, 2017 at 4:36 AM, David Sweeris via swift-evolution <span>&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</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_-4400418474714830553m_-412286965437656225h5"><div dir="auto"><span><div><br></div><div>On Jul 23, 2017, at 09:15, Matheus Martins via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div><div>I came across what i think is an inconsistency in the standard library.</div><div><br></div><div>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?</div><div><br></div><div>I came across this while trying to write some generic code:</div><div><br></div><div><div>func array&lt;T: LosslessStringConvertible&gt;(_ text: String) -&gt; [T?] {</div><div><span class="m_-4400418474714830553m_-412286965437656225m_5510885133438737253m_549651671855291146gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>return text.components(separatedBy: &quot; &quot;).map { T($0) }</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(&quot;1.0 2.2 3&quot;)</div><div><br></div><div>but i can&#39;t do:</div><div><br></div><div>let ints: [Int] = array(&quot;1 2 3 4 5 6&quot;)</div><div>&quot;<span style="color:rgb(255,255,255);font-family:Inconsolata,Monaco,Menlo,&#39;Ubuntu Mono&#39;,Consolas,source-code-pro,monospace;font-size:13px;background-color:rgb(38,74,96)">type &#39;Int&#39; does not conform to protocol &#39;LosslessStringConvertible&#39;</span>&quot;</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/protocol/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&#39;t find any discussion on this on any mailing list or website.</div></div></div></blockquote><br></span><div>Sounds like it&#39;s a bug to me, either in the docs or stdlib, depending on the intended behavior. Although I doubt they would&#39;ve used Int in the docs if they weren&#39;t intending Int to conform to it.</div><div><br></div><div>- Dave Sweeris</div></div><br></div></div>_______________________________________________<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/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>
</blockquote></div></div>
_______________________________________________<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/mailman/listinfo/swift-evolution</a><br>
</blockquote></div></div>