Globalization API discussion

David Herman dherman at mozilla.com
Sun Nov 20 13:18:29 PST 2011


On Nov 20, 2011, at 2:24 PM, Brendan Eich wrote:

> On Nov 20, 2011, at 11:16 AM, Allen Wirfs-Brock wrote:
> 
>> Actually, I think you would want to say:
>> 
>>   function frob(arg1, arg2, {foo = defFoo, bar = defBar, baz = defBaz}={}) {
> 
> Thanks.
> 
> 
>> It may be that for destructuring, in general,  we want to treat a null/undefined RHS as { }.  Eg:
>> 
>> let {a=1,b=2,c=3} = undefined;
>> //should this throw or should this be the same as:
>> let {a=1,b=2,c=3} = { };
> 
> 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.

Dave

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111120/d0710285/attachment.html>


More information about the es-discuss mailing list