Revisiting Decimal (generic algorithms)
Allen.Wirfs-Brock at microsoft.com
Fri Jan 16 14:25:48 PST 2009
>From: Brendan Eich [mailto:brendan at mozilla.com]
>Sent: Friday, January 16, 2009 12:12 PM
>> This problem cannot be fixed simply by tweaking the coercion rules.
>> It probably requires that numeric literals be treated as generic
>> values that are only interpreted situationally as either binary or
>> decimal values in the context of a particular operations.
>That, or multimethods so we don't essentially carry around literals in
>source form and pay high costs converting them according to context.
>That was the ES4 solution at one point, until we started cutting.
>Based on Dylan and Cecil precedents:
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. However choosing that over maintaining the source form sounds like an implementation rather than specification decision.
More information about the Es-discuss