[swift-evolution] [Pitch] Nil struct

Anton Zhilin antonyzhilin at gmail.com
Tue Nov 8 15:07:53 CST 2016


2016-11-08 23:53 GMT+03:00 Pyry Jahkola <pyry.jahkola at iki.fi>:

Then why not just:
>
>     public protocol ExpressibleByIntLiteral {
>       static var `nil`: Self
>     }
>
> …such that Foo.nil creates your nil value of type Foo?
>
This proposal is not about creating an alternate syntax for nil as
Optional<Foo>. It’s about granting nil literal its own type:

let a = nilprint(type(of: a))  //=> Nil

​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161109/a237623f/attachment.html>


More information about the swift-evolution mailing list