Es-discuss - several decimal discussions
brendan at mozilla.org
Sat Aug 23 19:58:00 PDT 2008
On Aug 23, 2008, at 1:23 PM, Maciej Stachowiak wrote:
> One possible way to achieve "fail fast" in a library only solution
> would be to specify that Decimal.prototype.valueOf always throws an
> exception. This would make an attempt to add or multiply using the
> operator throw, but would still allow decimal numbers to be printed,
> and would allow for explicit conversion methods.
We talked about that, and it seemed necessary to future-proof, but it
was not championed by anyone, and Adam Peller (of IBM, filling in for
Sam) was not able to say "yea" or "nay".
Throwing from valueOf (or a decimal [[DefaultValue]] override,
equivalently) still looks unusably crufty: relationals and equality
operators throw given a Decimal operand. Evaluation rules that pass a
"number" hint could be made to work, but no-hint cases like + and the
I'd rather see operators specified, but without any rushing for 3.1,
or slipping 3.1 just for Decimal-with-operators.
More information about the Es-discuss