<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 7, 2016, at 9:56 AM, James Campbell &lt;<a href="mailto:james@supmenow.com" class="">james@supmenow.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">So what would none do for arrays ?<div class=""><br class=""></div><div class="">Would it auto initialize an empty array ?&nbsp;</div><div class=""><br class=""></div><div class="">If so would love to play around with alternative key words</div></div></div></blockquote><div><br class=""></div><div>If I understand Amir correctly, they're proposing that 'none' place the variable in a dynamically invalid state, and the program will trap if the value isn't set before use.</div><div><br class=""></div><div>-Joe</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jan 7, 2016 at 5:50 PM, Joe Groff via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br class="">
&gt; On Jan 7, 2016, at 9:46 AM, Amir Michail via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class="">
&gt;<br class="">
&gt; Examples:<br class="">
&gt;<br class="">
&gt; var x:Int = none // uninitialized but not an optional<br class="">
&gt;<br class="">
&gt; print(x) // run-time error as x is uninitialized<br class="">
&gt;<br class="">
&gt; if x == nil { … } // compile time error… x can never be nil because it is not an optional<br class="">
&gt;<br class="">
&gt; if x == none { x = 2 } // … but it can be uninitialized<br class="">
&gt;<br class="">
&gt; Optionals can also be uninitialized:<br class="">
&gt;<br class="">
&gt; var y:Int? = none // uninitialized and an optional<br class="">
&gt;<br class="">
&gt; if y == nil { … } // run-time error as y is uninitialized<br class="">
&gt;<br class="">
&gt; y = nil<br class="">
&gt;<br class="">
&gt; if y == nil { … } // fine<br class="">
<br class="">
</span>This use case should be supportable as a property behavior; check out the "delayed" example from my proposal:<br class="">
<br class="">
<a href="https://gist.github.com/jckarter/f3d392cf183c6b2b2ac3" rel="noreferrer" target="_blank" class="">https://gist.github.com/jckarter/f3d392cf183c6b2b2ac3</a><br class="">
<br class="">
-Joe<br class="">
<div class="HOEnZb"><div class="h5">_______________________________________________<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" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</div></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><span style="font-size:16px;line-height:19.2px" class=""></span><span style="font-size:12.8px" class="">&nbsp;Wizard</span><br class=""></div><div class=""><a href="mailto:james@supmenow.com" target="_blank" class="">james@supmenow.com</a></div><div class="">+44 7523 279 698</div></div></div></div></div></div>
</div>
</div></blockquote></div><br class=""></body></html>