[swift-evolution] [Draft][Proposal] Formalized Ordering
Tony Allevato
allevato at google.com
Fri Jul 22 11:01:18 CDT 2016
On Fri, Jul 22, 2016 at 8:54 AM Dmitri Gribenko via swift-evolution <
swift-evolution at swift.org> wrote:
> 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.
>
SE-0091 does not (is not intended) to remove non-protocol operators. Global
free operators can still exist; that proposal only clarifies the way that
operator requirements within protocols manifest on conforming types (and
how lookup is affected as a result).
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160722/660b240a/attachment.html>
More information about the swift-evolution
mailing list