indirect eval spec too severe?

Brendan Eich brendan at
Sun Jan 25 01:01:36 PST 2009

On Jan 25, 2009, at 12:24 AM, David-Sarah Hopwood wrote:

> Brendan Eich wrote:
>> On Jan 24, 2009, at 4:51 PM, Mark Miller wrote:
>>> The current spec language allows the global eval property to be, in
>>> effect, either mutable or not, benefiting no one. If we need to  
>>> allow
>>> correct programs to be able to mutate it (in an initial  
>>> environment in
>>> which it has not yet been frozen), then we should change the spec to
>>> require it to be initially mutable, so that correct programs can  
>>> rely
>>> on this.
>> ES3 already requires eval to be a mutable global property, [...]
> No, it does not, because attempting to assign global 'eval' may  
> instead
> throw EvalError (ES3 section

Right you are -- thanks. That makes it a standard option for  
implementations, unlike the option of silently failing to assign to  
eval due to a ReadOnly attribute (what I took Mark to be proposing if  
eval assignment were not something required for compatibility).

The fact remains that no implementation I know of throws EvalError on  
assignment to the eval property of the global object. The spec words  
allowing EvalError to be thrown are probably dead letters.

IIRC, Opera implementations in the past threw EvalError for indirect  
evals (not sure about assignment to eval), but doing so was too web- 
incompatible. Cc'ing Chris Pine to confirm.


More information about the Es-discuss mailing list