[EMAIL PROTECTED] wrote:
> On Sat, Aug 23, 2008 at 10:04 AM, Sam Ruby <[EMAIL PROTECTED]> wrote:
>> Decimal implemented as a library would be sufficient for a 3.1
>> release.  The problem is an interoperable definition for what infix
>> operators is required for completeness.  Taking no other action, the
>> default behavior for the result of a "+" operator given a Number and a
>> library provided Decimal would be to convert both to string
>> representations and concatenate the results.
> 
> In other words, the same as the "+" operator given a Number and a
> library provided Employee, Document, PopupWidget, ..., or any other
> user defined type.

Having Decimal.parse(2) + 3 produce "23" is not what I would call "fail 
fast", as that is a term I would typically use for throwing an exception 
or the like.

>> This was discussed at the last ECMA TC39 meeting in Oslo, and was
>> found to be unusable and would create a backwards compatibility issue
>> for Harmony.
> 
> With respect, I wonder what these would be. It seems that the
> fail-fast behavior in this case is useful for (as I pointed out) stuff
> like helping establish Sarbanes-Oxley compliance. I understand that
> such requirements are why we need decimal arithmetic in the first
> place.

At most, Sarbanes-Oxley might be an example of one source for requirements.

>> ... spec'ing the operators would not be all that difficult. ... there
>> are some usability concerns relating to mixed mode operations
>> that we need to work through.
> 
> It is precisely these concerns that cause me to wonder if there's a
> foundational issue here. Are decimals indeed a different enough beast,
> and the pitfalls subtle enough (even if they can be specified
> completely), that mixed mode should simply not be supported (i.e.,
> made to fail-fast in some backwards compatible way)?

I don't believe the concerns are that decimals are a "same enough" or a 
"different enough beast", but rather that "fail fast" is not the type of 
behavior one would expect from ES for numeric operations.  And to be 
clear, this is less of a concern with arithmetic operators than with 
relational operators.  It would not be wise for equality operators, in 
particular, to start throwing exceptions.

> And if mixed mode is not supported, does that mean the library
> approach is adequate?
> 
> Ihab

- Sam Ruby

_______________________________________________
Es-discuss mailing list
Es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to