Globalization API discussion

Brendan Eich brendan at mozilla.com
Sun Nov 20 20:30:01 PST 2011


On Nov 20, 2011, at 1:18 PM, David Herman wrote:

>> I would not add more implicit magic to JS. E4X had junk like this in it, which only ever concealed bugs.
> 
> I'm of two minds about this. In the abstract, I agree with Brendan; fail-soft conceals bugs. But in reality, our destructuring logic is incredible fail-soft. Hardly anything in destructuring is treated as an error. And the syntax really *wants* to match the common pattern. So I'm torn.

1. Failing to write that means a destructuring parameter with default values within the pattern cannot be observed via arguments[i] as undefined (or null?). If missing, the undefined will be replaced by a fresh object. This isn't consistent with any other combination of destructuring parameters and parameter default values.

2. If a function wants to throw an error for a missing options parameter, it has no way of telling other than arguments.length checking.

3. It's not hard to write " = {}".

/be


More information about the es-discuss mailing list