<div dir="ltr">Its worth mentioning that in some languages such as &quot;!&quot; is used to denote a potentially dangerous operation, so the existing system I feel is fine :) </div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 7, 2016 at 11:53 PM, Austin Zheng via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">So we go from knowing that variables are never accessed in an uninitialized state at compile-time (because the compiler checks for us), to not knowing if a variable is uninitialized at runtime until we check for &#39;none&#39;? If I wanted a variable that could be uninitialized I would prefer to use an IUO; that way at least I can see the &#39;!&#39; in the type definition and be aware that I need to check for nil before I can properly use the variable if needed.<div><br></div><div>More generally, I am strongly against turning compile-time checks into runtime checks unless there&#39;s a compelling reason.</div><div><br></div><div>Austin</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 7, 2016 at 3:44 PM, Amir Michail via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><blockquote type="cite"><div>On Jan 7, 2016, at 3:15 PM, Jarod Long &lt;<a href="mailto:jrd@lng.la" target="_blank">jrd@lng.la</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word"><div>None is really just another way of saying something is nil, and a type suffix to allow assigning none is exactly equivalent to implicitly-unwrapped optionals, so I don&#39;t see any value in replacing them with this feature.</div></div></div></blockquote><div><br></div></span><div>“None&quot; means a variable is uninitialized. “Nil&quot; need not mean that.</div><div><br></div><div>Reading an uninitialized variable is an error. Reading a nil variable need not be.</div><div><br></div><div>With “none&quot;, you can have uninitialized variables without resorting to optionals or implicitly unwrapped optionals.</div><br><blockquote type="cite"><div><div style="word-wrap:break-word"><span><div><br></div><div>Not requiring a type suffix to assign none would be equivalent to allowing assignment of nil to any type, making everything an implicitly-unwrapped optional. You lose the compile-time nil safety that optionals provide, and the compiler likely loses many optimization opportunities because there are many situations where it can&#39;t know (or it is very difficult to know) whether a value could have possibly been assigned none at some point.</div><div><br></div><div>I understand the desire to reduce optionality to make code cleaner, but this kind of feature actually hides complexity and makes things more difficult in the long run. Implicitly-unwrapped optionals are a good compromise between cleanliness and effectively communicating when something can fail at run time.</div><div><br></div><div>Jarod</div><br></span><div><blockquote type="cite"><div><div><div>On Jan 7, 2016, at 11:41, Amir Michail via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br></div></div><div><div><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><br>Sent from my iPad</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>On Jan 7, 2016, at 2:34 PM, Félix Cloutier &lt;<a href="mailto:felixcca@yahoo.ca" target="_blank">felixcca@yahoo.ca</a>&gt; wrote:<br><br></div><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>Yes, but following your suggestion, there may not be a difference between a non-optional value and an implicitly-wrapped optional, meaning that there will be a lot more of them.<br></div></blockquote><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Variables that are never assigned &quot;none&quot; need not have these runtime checks. Alternatively, you can have a type suffix similar to ? to indicate that a variable may be in an uninitialized state. </div><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><div><br><span style="font-family:&#39;Lucida Grande&#39;;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Félix</span></div><br><div><blockquote type="cite"><div>Le 7 janv. 2016 à 14:10:44, Amir Michail &lt;<a href="mailto:a.michail@me.com" target="_blank">a.michail@me.com</a>&gt; a écrit :</div><br><div><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Jan 7, 2016, at 2:09 PM, Félix Cloutier &lt;<a href="mailto:felixcca@yahoo.ca" target="_blank">felixcca@yahoo.ca</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word">That would leave you with runtime checks instead of compile-time checks and I totally disagree with that.<br><div><br></div></div></div></blockquote><div><br></div><div>Implicitly unwrapped optionals do runtime checks also.</div><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><span style="font-family:&#39;Lucida Grande&#39;;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Félix</span></div><br><div><blockquote type="cite"><div>Le 7 janv. 2016 à 13:45:21, Amir Michail &lt;<a href="mailto:a.michail@me.com" target="_blank">a.michail@me.com</a>&gt; a écrit :</div><br><div><div style="word-wrap:break-word"><br><div><blockquote type="cite"><div>On Jan 7, 2016, at 1:40 PM, Félix Cloutier &lt;<a href="mailto:felixcca@yahoo.ca" target="_blank">felixcca@yahoo.ca</a>&gt; wrote:</div><br><div><div style="word-wrap:break-word">An implicitly-unwrapped optional would do almost that, no?<br><div><br></div></div></div></blockquote><div><br></div><div>You can use “none” to eliminate implicitly unwrapped optionals from the language.</div><br><blockquote type="cite"><div><div style="word-wrap:break-word"><div><span style="font-family:&#39;Lucida Grande&#39;;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Félix</span></div><br><div><blockquote type="cite"><div>Le 7 janv. 2016 à 12:46:53, Amir Michail via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; a écrit :</div><br><div><div>Examples:<br><br>var x:Int = none // uninitialized but not an optional<br><br>print(x) // run-time error as x is uninitialized<br><br>if x == nil { … } // compile time error… x can never be nil because it is not an optional<br><br>if x == none { x = 2 } // … but it can be uninitialized<br><br>Optionals can also be uninitialized:<br><br>var y:Int? = none // uninitialized and an optional<br><br>if y == nil { … } // run-time error as y is uninitialized<br><br>y = nil<br><br>if y == nil { … } // fine<br><br>_______________________________________________<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/mailman/listinfo/swift-evolution</a><br></div></div></blockquote></div><br></div></div></blockquote></div><br></div></div></blockquote></div><br></div></div></blockquote></div><br></div></div></blockquote></div><br></div></blockquote></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=8K1sNvSH2KR-2BkHEodrUTpf34ATsvtwNhFabfhxmB11RfPZORvm3qiYpH119HK-2BtUiKmVo0e7KNU0BkWmEMqCovcmHjrvs0Qr0Rsz4EPHpW-2FDqGL1fhfF6z4nwardSGPcsABLTL5X4OVmZi5HatJF0uAUBItCH2t-2F95hCWoWgpns8ziSfO009LCDjv-2FCTKoc1c-2FtEX-2B1x8aysOV-2BCVkUDig-3D-3D" alt="" width="1" height="1" border="0" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><span> </span></span><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">_______________________________________________</span><span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span></div></blockquote></div><br></div></div></blockquote></div><br>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=7XtDdMHRjqIUi4tzSjSp2pWQIyxYdP6woIWn4vwV5gc6cdrum5AL7e7AAjbWQoKDyxjZHIkJSKP9dvwAsbFVpXdpDpn8TNDzhn1h-2BW-2BYG1LkaZCOJk9NK9FgB1S3fj5SqIlAIBrJqjry65F6Ou1dgocTAhumGIZkYFtfAINmRRArCRL6YVWEXq2ocuHEchTp9MxGWvU6e25eP1mEYvgvsSvZgADRYrnXsrprkia02WA-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>
<br>_______________________________________________<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>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=xV0JY-2FdZMnUMvSFtZnLiBPRTDDOSQf3-2FpH33HYOlBxEgFk2VrrGvuQPQ9hYjLG7eyxCBvgr-2BWIiGZYlW9VEFjRonNwo0wratVxztIAV8zSU-2Bl6ASc-2Bz0f-2BV5EgwKCVuaX1gdIvD9ceOwthvjwpPX0h2sYyPk0faJj0s2sjvX-2BGu42v12wQY40StbYiYrnIwgVoUEhIClljmPX12kqufJTZOox9tUTtN0lAE-2BPDvoetw-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div></div><br>_______________________________________________<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/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-size:16px;line-height:19.2px"></span><span style="font-size:12.8px"> Wizard</span><br></div><div><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a></div><div>+44 7523 279 698</div></div></div></div></div></div>
</div>