Consistent decimal semantics
brendan at mozilla.org
Thu Sep 4 11:17:07 PDT 2008
On Sep 4, 2008, at 8:30 AM, Sam Ruby wrote:
> In particular, does that imply the need for a wrapper class?
Yeah, if you want !0m == true then we are back to the future:
* There's a decimal primitive type, autowrapped when used as an
object by Decimal.
* The decimal primitive acts like a value type.
* Decimal wrapper instances are mutable objects manipulated by
* Decimal.prototype contains methods, etc.
* Calling Decimal(x) as a function converts a la Number.
This was an outcome Lars Hansen explored earlier this year or late
last year, when we were trying to align ES4 decimal (primitive only,
shares Number.prototype) with ES3.1 Decimal.
Sorry I steered you down the "Decimal is an object" route. As you
argued, that plan is tenable if we can live with !0m == false, but it
seems unusably confusing and fatally frustrating to generic
programming (if (!falsy) ...).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Es-discuss