Paul, Basically, nil is a literal and not a shortcut or alias for Optional.none.
Types which implement NilLiteralConvertible can have a new instance initialized by the ‘nil’ literal. There is an initializer on Optional that is used to generate an Optional.none in response to a nil literal when expecting an Optional type. There are also similar Convertible protocols Boolean, String, Array, Dictionary, Floating point and Integer literals. The use cases for the nil literal within the standard library are decreasing. However, I have used it for a few other rare cases (most notably a native JSON library). -DW > On Apr 10, 2016, at 2:53 PM, Paul Young via swift-evolution > <[email protected]> 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 > [email protected] > https://lists.swift.org/mailman/listinfo/swift-evolution
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
