<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>You may be right, but I'd imagine such a conversion function would be in pretty much any library for serializing/deserializing data.</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">I can't recall if this has been discussed before, but are we committed to One Standard Library to Rule Them All, or might we consider having a "standard" library and a "common extensions" library? (Personally, I'd prefer them to be split up so that 3rd-party library authors can import only what they need, but maybe that's just me.)</div><div id="AppleMailSignature"><br>- Dave Sweeris</div><div><br>On Jun 4, 2016, at 08:26, Taras Zakharko via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=us-ascii">IMO, that is too idiosyncratic to be a standard language feature. You should extend Bool based on the specific needs of your application. Thats what the extensions are for.&nbsp;<div class=""><br class=""></div><div class="">Best,&nbsp;</div><div class=""><br class=""></div><div class="">&nbsp;t.&nbsp;<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 04 Jun 2016, at 15:10, Arsen Gasparyan via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hello,<div class=""><br class=""></div><div class="">It would be great if we had `<span style="color:rgb(51,51,51);font-size:12px;white-space:pre-wrap" class="">init?(_ text: </span><span class="inbox-code-object" style="font-size:12px;white-space:pre-wrap;color:rgb(145,0,145)">String</span><span style="color:rgb(51,51,51);font-size:12px;white-space:pre-wrap" class="">)</span>` for Bool class. Because sometime when you're processing&nbsp;JSON/XML it can help you a lot.</div><div class=""><br class=""></div><div class="">Examples:</div><div class=""><br class=""></div><div class=""><pre class="inbox-code-java" style="margin-top:0px;margin-bottom:0px;padding:0px;max-height:30em;overflow:auto;white-space:pre-wrap;word-wrap:normal;color:rgb(51,51,51);font-size:12px">Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"<span class="inbox-code-keyword">true</span>"</span>) -&gt; <span class="inbox-code-keyword" style="color:rgb(0,0,145)">true</span>
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"<span class="inbox-code-keyword">false</span>"</span>) -&gt; <span class="inbox-code-keyword" style="color:rgb(0,0,145)">false</span>
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"TrUE"</span>) -&gt; <span class="inbox-code-keyword" style="color:rgb(0,0,145)">true</span>
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">" <span class="inbox-code-keyword">true</span> "</span>) -&gt; nil
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"1"</span>) -&gt; nil
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"Y"</span>) -&gt; nil
Bool(<span class="inbox-code-quote" style="color:rgb(0,145,0)">"whatever"</span>) -&gt; nil </pre><pre class="inbox-code-java" style="margin-top:0px;margin-bottom:0px;padding:0px;max-height:30em;overflow:auto;white-space:pre-wrap;word-wrap:normal;color:rgb(51,51,51);font-size:12px"><br class=""></pre><pre class="inbox-code-java" style="margin-top:0px;margin-bottom:0px;padding:0px;max-height:30em;overflow:auto;white-space:pre-wrap;word-wrap:normal;color:rgb(51,51,51);font-size:12px"><br class=""></pre></div>via <a href="https://bugs.swift.org/browse/SR-1282" class="">https://bugs.swift.org/browse/SR-1282</a><div class=""><br class=""></div><div class="">Thanks.</div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>