[swift-evolution] Discussion: Why is "nil" not "none"

Brandon Knope bknope at me.com
Sun Jun 5 14:35:10 CDT 2016


Quick thought:

If optional has a .none case, wouldn't it be more consistent to rename nil to none?

Also, would nil make it into Swift if not for other languages?

It also might make it somewhat clearer:

var someInt: Int? = none //looks less like a pointer and more like a value of nothing 

1. It is more consistent with the optional enum
2. The intent is arguably clearer
3. nil makes it seem like it's a pointer 
4. Would nil be included if not for prior languages? Would "none" have been chosen as the keyword if nil wasn't prior art?

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 .

On vacation from Orlando, poolside, with a quick thought,
Brandon 


More information about the swift-evolution mailing list