This is a clean approach but that would not solve the example I mentioned.
let document: Document = [
"key" = nil // won't work for the second version of the implementation I
mentioned
]
Do solve this problem here, I’d need a real Nil type I could extend.
extension Nil : MyProtocol { … }
Than the above example will work correctly.
--
Adrian Zubarev
Sent with Airmail
Am 8. November 2016 um 21:53:44, Pyry Jahkola ([email protected]) schrieb:
If we start from this thought…
Adrian Zubarev wrote:
Shouldn’t it be just like this:
public protocol ExpressibleByNilLiteral {
init(nilLiteral: Nil)
}
Then why not just:
public protocol ExpressibleByIntLiteral {
static var `nil`: Self
}
…such that Foo.nil creates your nil value of type Foo?
— Pyry
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution