repeated parameter names and default values

Brendan Eich brendan at mozilla.org
Thu Sep 27 13:40:31 PDT 2012


Allen Wirfs-Brock wrote:
> On Sep 27, 2012, at 10:26 AM, Brendan Eich wrote:
>>> Also, at the last meeting there was some significant push back about the load-time costs (startup latency) of early error detection.
>> That's an issue for sure but we talked last week about less-than-early errors for some things. OTOH even a stripped down parser or "reader" must cope with some name binding checks per ES5 strict mode (as well as recognizing "use strict";). That ship sailed. Same goes for duplicate property names in object literals in strict mode.
>>
>> The real objection was to full name def/use analysis, which this is not. Duplicate formals are pretty easy to detect and you have to throw an early error for any such given a "use strict"; (later!) in the same function.
>
> So the purpose my original posting is achieved.

Ok, but...

>    I'm all for statically disallowing many of these "stupid" cases and I think it is fine to do the checks at "first call" rather than load-time (a off-line static linter could be more aggressive in reporting such errors).

No. As a matter using accurate language, that's not "statically".

More, you didn't respond to my "use strict"; point. Are you going to 
change whether duplicate parameters with "use strict"; in the function 
prologue throw an early error, or not?

>    Since the consensus here seems to be the same, I'll take that approach as I update the spec.

We have not discussed error-on-first-call in this thread at all!

/be


More information about the es-discuss mailing list