2016-11-09 0:12 GMT+03:00 Adrian Zubarev <adrian.zuba...@devandartist.com>:

Could you elaborate an implementation for one of these functions:
>
func == <T>(left: T?, right: Nil) {
    switch left {
        case .some(_): return false
        case .none: return true
    }
}

The implementation is basically the same as of now, except that instead of
Nil, there is _OptionalNilComparisonType.

Main use case of Nil would essentially be partial specialization of
functions.
See example with optional comparison: there exists a generic version that
takes a proper ExpressibleByNilLiteral (in this case Optional<T>), but we
can apply simpler logic in case we see nil.

Frankly speaking, I’m not sure myself this feature would find any use
except for the mentioned optional comparison operators.
So I will probably stop pushing this forward.
​
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to