[swift-evolution] [Draft][Proposal] Formalized Ordering
matthew at anandabits.com
Fri Jul 22 17:55:40 CDT 2016
> On Jul 22, 2016, at 5:50 PM, Stephen Canon <scanon at apple.com> wrote:
>> On Jul 22, 2016, at 6:34 PM, Matthew Johnson via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> Sorry if it wasn’t clear. I’m not suggesting taking that away. I’m asking whether we have considered defining `==` on floating point types to be the equivalence relation that is proposed for `areSame` and giving the domain specific operation a different name.
>> Maybe this would break with convention too much, but it would feel much more intuitive (to me at least - although I am admittedly not a numerics expert).
> IEEE754 doesn’t specify language bindings, so it *is* allowed to e.g. provide an `isEqualIEEE754` predicate and make `==` do something else.
> However, doing so would break with the precedent set by … well, every mainstream programming language of the past 30 years, and make porting existing numeric code an error-prone process for anyone who hadn’t carefully studied this particular aspect of Swift.
Thanks for chiming in Steve. I know it isn’t a decision to be taken lightly for sure and breaking the convention may well not be the right idea. I just wanted to point out that maybe it is possible to consider this without giving up IEEE floating point conformance.
The fact that `==` isn’t always an equivalence relation makes me sad but maybe the industry is too far down that rabbit hole to consider anything else...
> – Steve
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution