section 12.14: Note about restoration of LexicalEnvironment may be appropriate
Jim Blandy
jimb at mozilla.com
Wed May 20 12:41:16 PDT 2009
Like the 'with' statement, the 'catch' clause of a 'try' statement can
establish local bindings. In both cases, the spec describes this in
terms of changing the execution context's LexicalEnvironment temporarily
and then restoring it.
In the description of 'with', there is a "NOTE" assuring the reader that
the LexicalEnvironment is always restored regardless of how the
contained statement terminates. This is clear enough, as step 7 of the
algorithm explicitly talks about how exceptions are to be handled, but
the note is still a nice sanity check.
It seems to me that the description of 'catch' ought to have essentially
the same note. The body of a catch clause is a Block and not a
Statement, so there's no need to mention exception handling, as Block
takes care of that, but this is kind of subtle.
More information about the es-discuss
mailing list