repeated parameter names and default values

Brendan Eich brendan at
Thu Sep 27 10:21:52 PDT 2012

Allen Wirfs-Brock wrote:
> So, it seems that nested function declarations must be instantiated and bound before parameter instantiation/default value initialization and that parameters that share a name with a such function declaration do not get reinitialized (with either an argument or default value) during parameter instantiation.

Yes, this was what I remember us agreeing to the other week (was it last 
week? A blur...).

It's the "simpler desugaring wins" case. Parameters are var-like and 
defaulting happens in the body.

Separately, I agree with David, Oliver, Jason, Mark and probably 
everyone that new syntax can mean new checks pulled in from strict mode. 
Duplicate formal parameters with defaulting? Error!

We did this in SpiderMonkey for duplicate formals + destructuring, and 
the same argument applies there. I don't remember what our default 
parameter impl does with dups, though.


More information about the es-discuss mailing list