On Oct 31, 2017, at 9:07 AM, Stephen Canon via swift-dev <swift-dev@swift.org> 
wrote:
> [Replying to the thread as a whole]
> 
> There have been a bunch of suggestions for variants of `==` that either trap 
> on NaN or return `Bool?`. I think that these suggestions result from people 
> getting tunnel-vision on the idea of “make FloatingPoint equality satisfy 
> desired axioms of Equatable / Comparable”. This is misguided. Our goal is 
> (should be) to make a language usable by developers; satisfying axioms is 
> only useful in as much as they serve that goal.
> 
> Trapping or returning `Bool?` does not make it easier to write correct 
> concrete code, and it does not enable writing generic algorithms that operate 
> on Comparable or Equatable. Those are the problems to be solved.

+100.  Swift isn’t the first language to face the problems of floating point, 
nor is it the first to try to shoehorn it into a framework like Equatable.  
Despite weird cases involving NaNs, I haven’t seen a significant example of 
harm that it causes in practice, nor have I seen a proposal that makes the 
state of the art *better* than it currently is.  IMO, better involves reducing 
existing pain without introducing new pains that are more significant than the 
old ones.

-Chris

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to