On Tue, Sep 11, 2012 at 10:33 AM, Brendan Eich <[email protected]> wrote:
> If you really want the Pythonic default parameter rules (evaluation in
> definition context) then you need to address the bad case Jason showed:
>
>   function foo(arg = []) {
>     arg.push('strange');
>     return arg;
>   }
>   foo(); // ['strange']
>   foo(); // ['strange', 'strange']
>
> This is a side channel and a big footgun. ES6 default parameters as proposed
> avoid it.

I agree that's terrible and should absolutely be avoided. Sorry for
bringing it up.

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

Reply via email to