typeof extensibility, building on my Value Objects slides from Thursday's TC39 meeting
brendan at mozilla.com
Sat Aug 3 20:29:05 PDT 2013
Claude Pache wrote:
> Le 4 août 2013 à 01:34, Brendan Eich<brendan at mozilla.com> a écrit :
>> Claude Pache wrote:
>>> Fixing `typeof` of old (null) and new value types would be a solution, but I'm rather definitely considering something like the defunct `Object.isObject()`. (As a side-note, I suggest `typeof uint64(0) === "number"` rather than `=== "object"` by default.)
>> That will make for bugs where number (double) loses precision, and other bugs where int64 carries too many bits of significand. It also violates the two-way
>> (typeof x == typeof y&& x == y)<=> (x === y)
>> which we want for 0 == 0L, 1 == 1L, etc. (and consider other value types; this goes back to our work with Sam Ruby for IBM on decimal in 2008-9).
> So, if I understand well, this mandates that int64 and float32 (for example) should have different typeof values, ergo both "object" (as in ) and "number" (as I proposed) are equally bad answers, and the most reasonable default value of typeof for int64 would be "int64"?
Yes, this was the consensus at the meeting (not reflected in
http://oksoclap.com/p/64ETm1ontG -- my fault -- but the slides are up to
date and capture all the action items:
>  http://wiki.ecmascript.org/doku.php?id=strawman:value_objects
That's out of date and I'm going to edit it for the next TC39 meeting.
Thanks (to everyone who replied) for being a good sounding board here on
es-discuss, in pre-strawman stage ;-).
More information about the es-discuss