[swift-evolution] [Pitch] Nil struct

Robert Widmann devteam.codafi at gmail.com
Tue Nov 8 15:15:15 CST 2016


-1.  This type is isomorphic to () from a language-internal perspective and will introduce an extra name for which no useful algorithms can be written against from an external one - which makes the proposal isomorphic to one that introduces a keyword without significant justification.

~Robert Widmann

2016/11/08 16:07、Anton Zhilin via swift-evolution <swift-evolution at swift.org> のメッセージ:

> 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 = nil
> print(type(of: a))  //=> Nil
> _______________________________________________
> 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/20161108/5d31ad2c/attachment.html>


More information about the swift-evolution mailing list