Could you elaborate an implementation for one of these functions:

func == <T>(left: T?, right: Nil)
…
I’m a little confused how these would work, because the types are different and 
the optional is either .none or .some(T) of type Optional<T> where the other 
side is Nil.



-- 
Adrian Zubarev
Sent with Airmail

Am 8. November 2016 um 22:07:53, Anton Zhilin (antonyzhi...@gmail.com) schrieb:

2016-11-08 23:53 GMT+03:00 Pyry Jahkola <pyry.jahk...@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to