In what ways does the following "eval" regularity break?

Brendan Eich brendan at mozilla.com
Sun Nov 2 18:08:31 PST 2008


On Nov 2, 2008, at 3:22 PM, Tobie Langel wrote:

> On Oct 30, 2008, at 22:28 , Brendan Eich wrote:
>> As far as I can tell (Prototype folks on this list, please help  
>> here), this is all synthetic test-fodder. The test scripts do not  
>> want a local var binding.
>
> I'm not sure what you mean by synthetic test-fodder in that case.

eval-created var bindings.


> The function which Maciej mentions is mainly used to evaluate the  
> content of script tags contained in an HTML snippet returned by an  
> ajax request. Although it's rare to need to define variables in that  
> context, the behaviour expected by users when they do so is for  
> those variables to live in the global scope.

Good to hear.


>> On the other hand, anyone evaluating
>>
>>  (function xxx(){ ["var x"].forEach(eval); })();
>>
>> would get a global var x, which should be the specified outcome,  
>> but which is probably a mistake on the programmer's part outside of  
>> test code.
>
> Agreed.
>
> Best,

Thanks,

/be



More information about the Es-discuss mailing list