Re: Backstory/rationale for disallowing -0 in Map keys and Sets?

2018-10-10 Thread Jordan Harband
The unfortunate result, however, is that a subclass that is *more* restrictive than the base class is not possible to write robustly - namely, if someone does `Set.prototype.add.call`, they'll bypass any of the criteria you've set up in the subclass. I would have vastly preferred that the base

Re: Backstory/rationale for disallowing -0 in Map keys and Sets?

2018-10-10 Thread T.J. Crowder
On Wed, Oct 10, 2018 at 7:03 PM Allen Wirfs-Brock wrote: > Yes, exactly. Thanks! -- T.J. Crowder ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Backstory/rationale for disallowing -0 in Map keys and Sets?

2018-10-10 Thread Allen Wirfs-Brock
> On Oct 10, 2018, at 3:42 AM, T.J. Crowder > wrote: > > the ambiguity that -0 and +0 are often hard to distinguish (Number's > `toString` returns `"0"` for both, for instance; operations involving them > largely don't care about the pseudo-sign of 0). Is that the rationale? > Basically,

Backstory/rationale for disallowing -0 in Map keys and Sets?

2018-10-10 Thread T.J. Crowder
Negative zero (-0) is the only value you can't use as a Map key or a Set value. Map's [`set`][1] and Set's [`add`][2] both explicitly replace it with +0. MDN makes a point of saying that "early drafts" of the ES2015 spec treated +0 and -0 as distinct, but that "changed" in ES2015. Looking at some