<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>&nbsp; It depends how you frame it.</div><div><br></div><div>When I see nil I think of 0 or a pointer.&nbsp;</div><div><br></div><div>let someInt: Int? = nil</div><div><br></div><div>Does someInt really have a value of 0? Is it really a pointer (because it looks like one). &nbsp;</div><div><br></div><div>let someInt: Int? = none</div><div>let someInt: Int? = .none</div><div><br></div><div>- Doesn't look like a pointer and can't be mistaken as one</div><div>- indicates the value is none: it contains absolutely nothing&nbsp;</div><div><br></div><div>Another example: dictionaries&nbsp;</div><div><br></div><div><span style="background-color: rgba(255, 255, 255, 0);">someDict[key] = nil</span></div><div>someDict[key] = none</div><div>someDict[key] = .none</div><div><br></div><div>To me this reads as the value for this key is none. It has no value.&nbsp;</div><div><br></div><div>I'm curious if "Foo is nil" reads better to you because it is what you/we are use to reading and not because it is actually better.&nbsp;</div><div><br></div><div>Also, it looks like Scala uses None for their option type so this isn't unprecedented.&nbsp;</div><div><br></div><div>Thanks,</div><div>Brandon&nbsp;</div><div><br></div><div>On Jun 7, 2016, at 8:30 PM, Saagar Jha &lt;<a href="mailto:saagarjha28@gmail.com">saagarjha28@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><p>That’s not quite what I meant. nil feels right to refer to an object-you can say “Foo is nil”, but you can’t really say that “Foo is none”, since while you can’t really use none as an adjective, as you can with nil. It’s really about what flows right-none is the opposite of some, but nil isn’t.</p>
<br><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 7, 2016 at 5:16 PM Brandon Knope &lt;<a href="mailto:bknope@me.com" target="_blank">bknope@me.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div></div><div>That's exactly the point I was going for.&nbsp;</div><div><br></div><div>none makes more sense in this context than nil in my opinion</div></div><div dir="auto"><div><br></div><div>Brandon&nbsp;</div></div><div dir="auto"><div><br>On Jun 7, 2016, at 8:10 PM, Saagar Jha &lt;<a href="mailto:saagarjha28@gmail.com" target="_blank">saagarjha28@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Well, some is the opposite of none in that if I don’t have some, I have none. nil is just a carry-over from Objective-C.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 7, 2016 at 5:07 PM Brandon Knope 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 dir="auto"><div></div><div>I guess for me it comes down to this:</div><div><br></div><div><b>Why were some and none chosen for as the cases for Optional?</b></div><div><br></div><div>As an extension of that, why does nil then represent none instead of the obvious none?</div><div><br></div><div>There has to be a reason why it's not:</div><div><br></div><div>enum Optional&lt;T&gt; {</div><div>case some(T)</div><div>case nil</div><div>}</div><div><br></div><div>None seems a lot more expressive and consistent with Optional.&nbsp;</div><div><br></div><div>I am comfortable and use to nil, but with swift being a new language, I thought it was worth opening up a discussion about possibly changing direction a little here.&nbsp;</div><div><br></div><div>Thanks,</div><div>Brandon&nbsp;</div></div><div dir="auto"><div><br>On Jun 7, 2016, at 7:57 PM, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><span>There are NilLiteralConvertible types other than Optional, but they’re dwindling now that pointer nullability is represented by Optional. That said, I’m not convinced renaming “nil” is worth it at this point. Similarity with other languages is still a good thing.</span><br><span></span><br><span>It’s true that we might not have picked nil if it hadn’t been for Objective-C, but that doesn’t make it an invalid choice. There are lots of things in Swift we might have done differently if it weren’t for Objective-C and Cocoa.</span><br><span></span><br><span>Jordan</span><br><span></span><br><span></span><br><blockquote type="cite"><span>On Jun 5, 2016, at 12:35, Brandon Knope via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Quick thought:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>If optional has a .none case, wouldn't it be more consistent to rename nil to none?</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Also, would nil make it into Swift if not for other languages?</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>It also might make it somewhat clearer:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>var someInt: Int? = none //looks less like a pointer and more like a value of nothing </span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>1. It is more consistent with the optional enum</span><br></blockquote><blockquote type="cite"><span>2. The intent is arguably clearer</span><br></blockquote><blockquote type="cite"><span>3. nil makes it seem like it's a pointer </span><br></blockquote><blockquote type="cite"><span>4. Would nil be included if not for prior languages? Would "none" have been chosen as the keyword if nil wasn't prior art?</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>One disadvantage is how close it is to .none, but with how common nil/none is used, some syntactic sugar might make it look nicer than always having the stray .</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>On vacation from Orlando, poolside, with a quick thought,</span><br></blockquote><blockquote type="cite"><span>Brandon </span><br></blockquote><blockquote type="cite"><span>_______________________________________________</span><br></blockquote><blockquote type="cite"><span>swift-evolution mailing list</span><br></blockquote><blockquote type="cite"><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br></blockquote><blockquote type="cite"><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></blockquote><span></span><br></div></blockquote></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 dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">-Saagar Jha</div></div>
</div></blockquote></div></blockquote></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">-Saagar Jha</div></div>
</div></blockquote></body></html>