assignment to eval in strict code

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Fri Feb 13 07:36:57 PST 2009


Allen Wirfs-Brock wrote:
> Now that we have decided that all declarations of the identifier
> "eval" are banned from strict code a related question has come up
> from one of the implementers of our strict mode prototype implementation.
> Why does Es3.1 still allow assignment to the identifier "eval" within
> strict code?   That does seem like a logical extension of the arguments
> that convinced us to ban strict mode eval declaration.  Does anyone have
> a reason why such an assignment would be a reasonable thing.
>
> Adding that assignment restriction is a bit of a feature creep but
> something that is probably manageable in the time we have left if the
> consensus is that it makes sense to do.

The prohibition on declaring 'eval' makes more sense in conjunction
with setting the properties of the global 'eval' property to be
non-[[Writable]] and non-[[Configurable]]. That can't be done
unconditionally for compatibility reasons, but it can be done in
specific JavaScript contexts. There is otherwise little point in
restricting assignment to 'eval' from strict code, if strict code
can still see changes to it that were made from non-strict code.

-- 
David-Sarah Hopwood ⚥



More information about the Es-discuss mailing list