> On Apr 13, 2017, at 5:18 PM, Xiaodi Wu via swift-evolution 
> <[email protected]> wrote:
> 
> Actually, the fact that this behavior cannot even be achieved without 
> currently non-existent compiler features means that it is not possible to 
> understand what's truly going on without reading *this document*, after 
> mastering *both* IEEE floating point *and* Swift 
> generics/protocols/extensions/static vs. dynamic dispatch. All to use `==` 
> correctly. Which is to say, most people will simply not even know if they 
> happen to be using the `==` they did not intend to use.
> 

If I understand correctly, I think you’re mistaken. The compiler already 
selects overloads based on generic context. If `T: FloatingPoint`, then it’ll 
choose the `==` with signature `<T: FloatingPoint> (T, T) -> Bool`. If `T: 
Equatable`, then it’ll choose the `==` with signature `<T: Equatable> (T, T) -> 
Bool`. No new compiler features are necessary for this specific behavior.

Cheers,
Jaden Geller
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to