[swift-evolution] [Draft][Proposal] Formalized Ordering

Dmitri Gribenko gribozavr at gmail.com
Fri Jul 22 10:53:56 CDT 2016

On Fri, Jul 22, 2016 at 8:38 AM, Nevin Brackett-Rozinsky
<nevin.brackettrozinsky at gmail.com> wrote:
> Excellent point Karl.
> In my view, floating point NaN values are really quite similar to `.none`.
> I would be interested in exploring a move *away* from the IEEE 754 handling
> of NaN. In particular, we could model Float and Double as optionals (maybe
> implicitly-unwrapped) with NaN bit-patterns indicating `.none`.
> Or we could model *just the non-NaN values* and make undefined operations
> trap, among other possibilities.

I think these are non-starters.

>>> 5. Will it be considered "ok" to define a type for which `T.areSame(a, b)
>>> == true` but `a != b`? An obvious example would be Double.nan, so I assume
>>> the answer is a resounding yes.
>> Yes, because `==` is not a protocol requirement of Equatable, so it
>> can have domain-specific semantics.
> Per SE-0091 the operator will be the protocol requirement.

If SE-0091 removes non-protocol operators, then we will have to change
the language again to accommodate what we need.


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the swift-evolution mailing list