Revisiting Decimal (generic algorithms)

Brendan Eich brendan at
Fri Jan 16 14:32:51 PST 2009

On Jan 16, 2009, at 2:25 PM, Allen Wirfs-Brock wrote:

>> I think that carry dual encodings (both binary and decimal) for  
>> each numeric literal might be a reasonable approach as long as we  
>> only have two types.

Excluding small integer literals, most numeric literals in my  
experience are small enough that carrying 8 + 16 = 24 bytes loses, but  
you're right that this is all implementation detail. Still, the spec  
is informed by implementor feedback, to the point that it can't be  
developed in a vacuum or it might be ignored.

>>  However choosing  that over maintaining the source form sounds  
>> like an implementation rather than specification decision.

Speaking for Mozilla, we probably can't tolerate anything like  
carrying around two representations, or source forms, for number  
literals. I'd have to measure non-int literals to say for sure, but  
gut check says no.

I'm not saying multimethods are the only way forward. I'm genuinely  
interested in new thinking about numbers and decimal, because of that  
most-frequently-dup'ed bug:

But I do not see a solution for it yet, and your point that we need to  
solve this just to get decimal+double into the language is right on.


More information about the Es-discuss mailing list