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

Brendan Eich brendan at
Wed Apr 21 07:04:39 PDT 2010

On Apr 19, 2010, at 11:13 PM, Peter van der Zee wrote:

> On Mon, Apr 19, 2010 at 11:25 PM, Brendan Eich <brendan at>  
> 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').
> This means that if you "use strict" you have to test your code in  
> pre-ES5 and ES5-or-above implementations, to be sure you're not  
> counting on the ES5 changes.
> Usually you won't have a problem, but testing is the only way to be  
> sure, if you are using eval and/or arguments in your strict code.
> Correct me if I'm wrong but in the case of "use strict", doesn't  
> that only apply restrictions? So as far as the difference between  
> "use strict" and no strict are concerned, if a script works in  
> strict mode shouldn't it also work in no strict?


var x = "global";
alert((function () { "use strict"; eval("var x = 'dynamic';"); return  

There are other such examples.

> I can't recall any parts of the spec that include backwards  
> incompatible extensions for that directive.
> Of course for new syntax or using future reserved keywords or  
> whatever, you're absolutely correct.

I was explicit in calling attention to eval and arguments.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list