On Sep 18, 2008, at 10:58 PM, Kris Zyp wrote:
>>> * Like Crock, I prefer that typeof 1m === 'number'. However, unlike
>>> Crock's
>>> and Brendan's agreement, I think this should be unconditional. I
>>> think it
>>> would be horrible for 'typeof X' to depend not only on the value
>>> of X but
>>> also on the mode of the program unit in which the typeof appears.
>>> Please
>>> don't do that.
>
> +1 for typeof 1m === 'number'. As an example of breakage, I believe
> Crockford's current version of his JSON library would not do as I
> would
> desire with decimals:
>
> JSON.stringify({foo:1m}) -> "{\"foo\":undefined}"
Why is that worse than producing '{"foo":1}'? Consider 1.1m instead
of 1m.
JSON does not provide for decimal, and receiver-makes-it-wrong is a
bug. JSON would need to be extended to handle decimal reliably.
> I think there is a may be a lot of code that is dependent on typeof
> returning a one of exactly six possible values.
There may be "a lot". There's probably some. But there's also
probably some code that breaks if decimals are added and they have
"number" typeof-type. There is no non-breaking way to add decimal.
/be
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss