Allen Wirfs-Brock wrote:
On Aug 6, 2013, at 12:40 PM, Brendan Eich wrote:

Allen Wirfs-Brock wrote:
We did discuss this, as record in 
https://bugs.ecmascript.org/show_bug.cgi?id=224 , and concluded that we it we 
didn't want to add any new built-in exceptions.  Of the existing exceptions , 
RangeError is closest in concept to what might be described as ValueError.
I'd be ok with adding DomainError -- dual, as Mark says -- cheap one-time 
addition, not repeated, sold out performance, retired and tax fugitive after 
;-).

See like a distraction to reopen an issue we already decided.

No, it's called revisiting and we do it because we do make mistakes :-P.

This one is too small to be a mistake, I agree, but your "distraction" word is off-target. TC39 has to revisit decided things now and then. We've done it before as Mark well knows.

Also don't really see that it helps much.  Right now, API designer have to make a 
decision about the murky distinction between TypeError (sometimes "type" is 
interpreted very loosely) and RangeError.  Adding DomainError would probably just add to 
the confusion and in the end it probably makes no difference.

No, it would be for the input/domain side, as range error should be for output/co-domain, where the type agrees but cannot express a value restriction.

If we don't have a principled approach we will go wrong with RangeError. Possibly we already have?

   Has anybody ever actually seen a JS exception handler that really needs to 
take conditional action depending upon whether as TypeError or RangeError was 
thrown?

That's not the issue. If you don't care about which (whatever the set of standard error types), you might as well toss a coin. But clearly we have some implicit rule or rules informing when to use RangeError vs. TypeError. Or are the rules explicit?

Saying the Java-esque "Error class hierarchy" is not useful for dispatching also ignores matching in catch clauses, on the Harmony agenda.

But even if we think everything here is a mistake, it is at least an attractive nuisance that trips up developers and other standards' caretakers. We need some ground rules and FAQ entries for when to use Type vs. Range, and why-no-Value/Domain.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to