Open Templates in ES3.1 strict (was: Refactoring out unused material)
Mark S. Miller
erights at google.com
Mon Jun 16 20:23:51 PDT 2008
On Mon, Jun 16, 2008 at 8:01 PM, Mike Samuel <mikesamuel at gmail.com> wrote:
> Will the open template stuff [<http://google-caja.googlecode.com/svn/changes/mikesamuel/string-interpolation-29-Jan-2008/trunk/src/js/com/google/caja/interp/index.html>] work in ES3.1 strict mode?
It looks like they will, but "open" will need to be spelled "eval", as
is needed anyway for compatibility with ES3 and today's browsers.
As Lars was working on ES4 strict, he noticed something interesting
about the eval operator: All the problematic interactions between eval
and strict mode had to do with adding (or removing) bindings from the
invoking scope. So long as the strict eval operator is limited to only
consuming bindings from its invoking scope, and all occurrences of the
strict eval operator are spelled "eval", all strict code remains
statically scoped. (Leaving aside a current ES4-only controversy
regarding the resurrection of "with".) For purposes of scope analysis,
an occurrence of the eval operator should conservatively be treated as
a use occurrence of all variables in scope at that point.
When Lars first suggested it, I was outraged. Then I realized he was
right. We are adopting this notion of the strict eval operator into
More information about the Es4-discuss