On Wed, Apr 12, 2017 at 7:23 PM, Darien Valentine <valentin...@gmail.com> wrote: >> One common JS problem is NaNs ending up in unexpected places, and it's >> often difficult to trace back where they came from. Getting a type error >> instead of a NaN would be nice. > > I’m not sure this would help with that. NaN may be the product of coercion, > but NaN itself is a numeric value, and it can be produced without any type > coercion, e.g. `Infinity/Infinity`, `(-1) ** 0.5`, etc. And the `===` > operator is a strict, non-coercive comparison, but that doesn’t mean it > throws type errors.
Mysterious NaNs in js are usually due to implicit conversion of random objects to numbers, not normal numeric computation. It's reasonable for non-coercing === to work on different types, but what would a non-coercing + do with different types? It has to throw an error. Non-coercing < might throw an error or use some arbitrary ordering of types. I don't have strong feelings about that. _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss