as described here
function f(a) {
// var a superflous ... still works
var a, b = a, a = 3, c = a;
return a+" "+b+" "+c;
}
same / equivalent result
On Thu, Sep 27, 2012 at 6:09 PM, Jason Orendorff
<[email protected]>wrote:
> On Thu, Sep 27, 2012 at 11:19 AM, Allen Wirfs-Brock
> <[email protected]> wrote:
> > function f(a, b=a, a=3, c=a) {
> > return a+" "+b+" "+c
> > }
> > console.log(f(1));
> >
> > Based upon the conclusions about argument binding at the recent TC39
> meeting this will display:
> > "3 1 3"
>
> Not having been at the meeting, I had a little trouble coming up with
> a desugaring where this worked. Is this the idea?
>
> function f(a, b, a, c) {
> var %args = a copy of arguments;
> a = %args[0];
> b = %args[1] === void 0 ? a : %args[1];
> a = %args[2] === void 0 ? 3 : %args[2];
> c = %args[3] === void 0 ? a : %args[3];
> return a+" "+b+" "+c;
> }
>
> (Of course I understand it won't be specified in terms of desugaring
> but through changes to 10.5.3, "Function Declaration Instantiation").
>
> For what it’s worth, I’m with David and Oliver: by all means, just
> make that a SyntaxError.
>
> -j
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss