[swift-evolution] Proposal: disallow nil in favor of .None

Chris Lattner clattner at apple.com
Sun Apr 10 16:34:23 CDT 2016


> On Apr 10, 2016, at 1:53 PM, Paul Young via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Please forgive me if this has already been discussed, but I couldn't find reference to it anywhere.
> 
> My proposal is pretty simple – disallow the use of `nil` and require the use of `.None` instead.
> 
> I would like to understand if there are any technical (or otherwise) reasons for `nil` to remain, or if it simply a remnant of interop with Objective-C.

Hi Paul,

There never was a “technical” reason for including nil - it is simply sugar for constructs that you could form some other way.  It wasn’t related to Objective-C interop, and I’m not aware of other changes that would affect the balance of “nil" in Swift.  If anything, “nil” is destined to become *more* simple, since only Optional will be NilLiteralConverible once the planned Swift 3 changes land ("abolish IOU" and “make nullability explicit for unsafe pointers”).

-Chris



More information about the swift-evolution mailing list