Strict Mode and Function

Dmitry A. Soshnikov dmitry.soshnikov at gmail.com
Wed Jun 2 11:38:28 PDT 2010


On 02.06.2010 22:22, Allen Wirfs-Brock wrote:
>> From: Dmitry A. Soshnikov
>>
>> But he referenced to the conformance test suite --
>> http://es5conform.codeplex.com/ and in particular for these test cases
>> -- http://vserver.rosseaux.net/stuff/tests/
>>
>> where is said that "arguments" and "eval" are allowed in such cases:
>>
>> http://vserver.rosseaux.net/stuff/tests/15.3.2.1-11-7-s.js -- arguments
>> http://vserver.rosseaux.net/stuff/tests/15.3.2.1-11-4-s.js -- eval
>>
>>      
> These tests are valid.  The constructed function is not "strict" because its body does not contain a "use strict" directive.

Yeah, I've already found out it (mentioned it in the second letter right 
after the first one). But really, this sentence from the Annex C is 
confusing. And without attentive reading 15.3.2.1, it can confuse.

>   The strictness of the caller of the Function constructor does not affect the strictness of the constructed function.

That's not relates only for Function functions. The strictness of the 
caller does not affect any function. However, the strictness is 
inherited lexically for FD (function declaration) and FE (function 
expression). But not for the Function functions. And that exactly I was 
confused after reading only that bullet from the Annex C.

>> So, is it an err in the Annex C statement or the tests are incorrect? I don't see the
>> same restriction in the exact 15.3.2 section as it mentioned in the Annex C.
>>
>>      
> See step 10 of 15.3.2.1
>
>    

Yup, as I said, I've already found out it and updated the document. But, 
thanks anyway for additional clarifications -- I think it will be useful 
for other to avoid such confusions. Btw, step 9 of 15.3.2.1 already 
informs us that Function function do not inherit the strictness from 
surrounding context(s).

Dmitry.


More information about the es-discuss mailing list