<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection">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't see any value in replacing them with this feature.<br />
<br />
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't know (or it is very difficult to know) whether a value could have possibly been assigned none at some point.<br />
<br />
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.<br />
<br />
Jarod</div>
<div name="messageSignatureSection"><br /></div>
<div name="messageReplySection"><br />
On Jan 7, 2016, 11:41 -0800, Amir Michail via swift-evolution <swift-evolution@swift.org>, wrote:<br />
<blockquote type="cite">
<div><br />
<br />
Sent from my iPad</div>
<div><br />
On Jan 7, 2016, at 2:34 PM, Félix Cloutier <<a href="mailto:felixcca@yahoo.ca">felixcca@yahoo.ca</a>> wrote:<br />
<br /></div>
<blockquote type="cite">
<div>
<meta http-equiv="Content-Type" content="text/html charset=utf-8" />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 class="" /></div>
</blockquote>
<div><br /></div>
<div>Variables that are never assigned "none" 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 />
<blockquote type="cite">
<div>
<div class=""><br class="Apple-interchange-newline" />
<span style="color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;" class="">Félix</span></div>
<br class="" />
<div>
<blockquote type="cite" class="">
<div class="">Le 7 janv. 2016 à 14:10:44, Amir Michail <<a href="mailto:a.michail@me.com" class="">a.michail@me.com</a>> a écrit :</div>
<br class="Apple-interchange-newline" />
<div class="">
<meta http-equiv="Content-Type" content="text/html charset=utf-8" class="" />
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class="" />
<div class="">
<blockquote type="cite" class="">
<div class="">On Jan 7, 2016, at 2:09 PM, Félix Cloutier <<a href="mailto:felixcca@yahoo.ca" class="">felixcca@yahoo.ca</a>> wrote:</div>
<br class="Apple-interchange-newline" />
<div class="">
<meta http-equiv="Content-Type" content="text/html charset=utf-8" class="" />
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">That would leave you with runtime checks instead of compile-time checks and I totally disagree with that.<br class="" />
<div class=""><br class="Apple-interchange-newline" /></div>
</div>
</div>
</blockquote>
<div class=""><br class="" /></div>
<div class="">Implicitly unwrapped optionals do runtime checks also.</div>
<br class="" />
<blockquote type="cite" class="">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class=""><span style="font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Félix</span></div>
<br class="" />
<div class="">
<blockquote type="cite" class="">
<div class="">Le 7 janv. 2016 à 13:45:21, Amir Michail <<a href="mailto:a.michail@me.com" class="">a.michail@me.com</a>> a écrit :</div>
<br class="Apple-interchange-newline" />
<div class="">
<meta http-equiv="Content-Type" content="text/html charset=utf-8" class="" />
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class="" />
<div class="">
<blockquote type="cite" class="">
<div class="">On Jan 7, 2016, at 1:40 PM, Félix Cloutier <<a href="mailto:felixcca@yahoo.ca" class="">felixcca@yahoo.ca</a>> wrote:</div>
<br class="Apple-interchange-newline" />
<div class="">
<meta http-equiv="Content-Type" content="text/html charset=utf-8" class="" />
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">An implicitly-unwrapped optional would do almost that, no?<br class="" />
<div class=""><br class="Apple-interchange-newline" /></div>
</div>
</div>
</blockquote>
<div class=""><br class="" /></div>
<div class="">You can use “none” to eliminate implicitly unwrapped optionals from the language.</div>
<br class="" />
<blockquote type="cite" class="">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class=""><span style="font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Félix</span></div>
<br class="" />
<div class="">
<blockquote type="cite" class="">
<div class="">Le 7 janv. 2016 à 12:46:53, Amir Michail via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> a écrit :</div>
<br class="Apple-interchange-newline" />
<div class="">
<div class="">Examples:<br class="" />
<br class="" />
var x:Int = none // uninitialized but not an optional<br class="" />
<br class="" />
print(x) // run-time error as x is uninitialized<br class="" />
<br class="" />
if x == nil { … } // compile time error… x can never be nil because it is not an optional<br class="" />
<br class="" />
if x == none { x = 2 } // … but it can be uninitialized<br class="" />
<br class="" />
Optionals can also be uninitialized:<br class="" />
<br class="" />
var y:Int? = none // uninitialized and an optional<br class="" />
<br class="" />
if y == nil { … } // run-time error as y is uninitialized<br class="" />
<br class="" />
y = nil<br class="" />
<br class="" />
if y == nil { … } // fine<br class="" />
<br class="" />
_______________________________________________<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" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="" /></div>
</div>
</blockquote>
</div>
<br class="" /></div>
</div>
</blockquote>
</div>
<br class="" /></div>
</div>
</blockquote>
</div>
<br class="" /></div>
</div>
</blockquote>
</div>
<br class="" /></div>
</div>
</blockquote>
</div>
<br class="" /></div>
</blockquote>
<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="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;" />_______________________________________________<br />
swift-evolution mailing list<br />
swift-evolution@swift.org<br />
https://lists.swift.org/mailman/listinfo/swift-evolution<br /></blockquote>
</div>
</body>
</html>