[swift-evolution] Remove nil and NilLiteralConvertible

Антон Жилин antonyzhilin at gmail.com
Wed Jun 8 15:41:15 CDT 2016


(No joking)
Points:

1. When nil was added to the language, we could not infer enumeration type:
if x != Optional.none { ... }

Now it looks like this:
if x != .none { ... }

If at this point we had a proposal to add nil as a replacement for .none,
would we accept it?

2. nil is very generic, it only approximately allows to express the
intentions.
In case of Optional, .none is clearer. In case of JSON processing, .null is
clearer. In case of a semantically nullable struct, NilLiteralConvertible
usually goes to default constructor.

3. Too many "empty" things: .none, nil; NSNull, Void, NoReturn types.

4. There should be a single consistent terminology: no value in Swift
equals none.

- Anton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160608/f34a1492/attachment.html>


More information about the swift-evolution mailing list