indirect eval spec too severe?
brendan at mozilla.com
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
>>> 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
>>> on this.
>> ES3 already requires eval to be a mutable global property, [...]
> No, it does not, because attempting to assign global 'eval' may
> throw EvalError (ES3 section 18.104.22.168).
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