In what ways does the following "eval" regularity break?
Brendan Eich
brendan at mozilla.com
Thu Oct 30 00:18:43 PDT 2008
On Oct 29, 2008, at 11:46 PM, Maciej Stachowiak wrote:
> Personally I think use of the local-scope eval should be
> discouraged. We should introduce an explicit globalEval function
> which has eval function rather than eval operator semantics, i.e.
> evaluates at global scope. In my experience, programs using eval
> rarely truly want local eval,
SunSpider has some evals that absolutely want their caller's scope.
> and so they are doing something that defeats lexecial analysis for
> no reason.
There are lots of dumb eval uses, but I do not agree that most eval
calls could be global-eval. The EXT Ajax library among many others
uses local eval to compile optimized selector-matching functions, e.g.
IIRC gmail uses local eval (and global).
> I think we should even consider banning local eval from strict mode.
In light of the examples I gave above, and more that are pretty easy
to find, I think this would make strict mode unused in practice.
/be
More information about the Es-discuss
mailing list