names [Was: Approach of new Object methods in ES5]

Asen Bozhilov asen.bozhilov at gmail.com
Fri Apr 23 13:24:14 PDT 2010


Brendan Eich wrote:
> On Apr 19, 2010, at 4:27 PM, Peter van der Zee wrote:
>
>> ES5 introduced the concept of directives, using perfectly fine 
>> fallback with no side effects. This was, as far as the above goes, 
>> perfect. Older implementations couldn't possibly trip over it since a 
>> string literal without anything else has no visible side effects.
>
> I should point out again that "use strict"; changes runtime semantics 
> involving eval and arguments in ES5, it does not merely prevent 
> programs from getting to runtime (i.e., it is not just stricter 
> syntax, e.g. forbidding 'with').
>
But ES5 strict mode is not change only runtime semantics. For example:

| 13  Function Definition
| 13.1 Strict Mode Restrictions
| It is a SyntaxError if the Identifier "eval" or the Identifier 
"arguments" occurs within a FormalParameterList
| of a strict mode FunctionDeclaration or FunctionExpression.

And from that quotation:
 
"use strict";
function eval(){}
function arguments(){}

Both function declarations are syntactical invalid by described rules of 
ECMA-262-5. The same is with variable declaration see 12.2.1 Strict Mode 
Restrictions.  And  there are  strict mode  restrictions  about future 
reserved words. For example:

var implements;

Is syntactical valid statement by ES5 non-strict mode. But the follow is 
not:

"use strict";
var implements;

When they do syntactical restriction in strict mode, why they are not 
remove automatic semicolon insertions?


More information about the es-discuss mailing list