[swift-evolution] Remove nil and NilLiteralConvertible

Brandon Knope bknope at me.com
Wed Jun 8 16:12:12 CDT 2016


Isn’t the only thing keeping nil relevant is the NilLiteralConvertible protocol?

Brandon

> On Jun 8, 2016, at 5:08 PM, John McCall via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> On Jun 8, 2016, at 1:41 PM, Антон Жилин via swift-evolution <swift-evolution at swift.org> wrote:
>> (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.
> 
> I know we're making a lot of source-compatibility breaks in Swift 3 and so these lines seem blurry, but I think the spelling of "nil" is quite solidly in the "that ship has sailed" category, along with "struct" and "func" and "var".
> 
> John.
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160608/6d0c3544/attachment.html>


More information about the swift-evolution mailing list