[swift-evolution] Proposal: disallow nil in favor of .None
Brandon Knope
bknope at me.com
Sun Apr 10 16:17:24 CDT 2016
What about adding a none keyword as a shortcut for .none?
Might be a little more consistent with optionals than nil which brings to mind pointers for most people
Sent from my iPad
> On Apr 10, 2016, at 5:13 PM, Radosław Pietruszewski via swift-evolution <swift-evolution at swift.org> wrote:
>
> Pretty sure it has been discussed already.
>
> MHO: much of the power of Optionals in Swift is that they’re more than just a .None/.Some(T) enum. They’re tightly integrated into the language. You never say .Some(value) — values are just lifted to optionals automatically. And if we never directly say .Some(T), why should we say .None? Let’s treat optionals as part of the language, and the enum an implementation detail. Let’s use automatic lifting to optionals, all the `if let`s and other helpful syntax, and say `nil` instead of .None — after all, it’s an important enough part of the language to deserve its own keyword. (A keyword, that, as an additional benefit, will be more immediately understood by someone new to Swift)
>
> — Radek
>
>> On 10 Apr 2016, at 22:53, 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.
>>
>> Thanks,
>>
>> Paul
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160410/f9bc64b2/attachment.html>
More information about the swift-evolution
mailing list