use decimal

Douglas Crockford douglas at
Wed Sep 17 13:01:54 PDT 2008

Brendan Eich wrote:
> On Sep 17, 2008, at 6:54 PM, Douglas Crockford wrote:
>> Also, programs that do opt in should continue to work as they do now 
>> on the ES3
>> processors. They will produce the same slightly incorrect totals, but 
>> will
>> otherwise behave as before.
>> An implementation of decimal that does not meet these goals must be 
>> rejected.
>> I think these goals require that  typeof decimal_number  produce 
>> 'number'.
> Only under the "use decimal" pragma, right?

I don't care what happens when -m notation is used without "use decimal". I 
think the best thing would be to have a syntax error, but I don't feel strongly 
about that, except that in the future, we may want to evolve to a language in 
which decimal would be the default representation. We should be cautious is 
doing anything that would prevent that possibility.

> As discussed previously in late August, typeof applied to any decimal 
> should not be "object" or else
> typeof x == "object" && !x => x === null
> is not preserved. Agreed?


> But double values leaking into a "use decimal" context, mixing with 
> decimal values in expressions, could be worse than a rare exception. 
> They could cause different control flow, depending on relational 
> operators: the missile launches when it should not. They would tend to 
> produce hard-to-find yet non-trivial bugs.
> It would be better to make it an error for a double to flow into a 
> mixed-mode expression in a "use decimal" context.

We should not be making standards until we can determine the extent to which 
that is better. It may be best to defer decimal to Harmony so we can try some 
experiments and have more confidence.

More information about the Es-discuss mailing list