Strict mode recap

Jon Zeppieri jaz at bu.edu
Thu Apr 3 09:10:17 PDT 2008


On Wed, Apr 2, 2008 at 11:15 PM, Lars Hansen <lhansen at adobe.com> wrote:
>  >
>  > Is this already in AS3?  If so, is it often used?
>
>  The syntax comes from E4X, which is incorporated into AS3 and
>  Spidermonkey.  Try this in Firefox:
>
>   <script type="text/javascript;e4x=1">
>   var x = <ns:p xmlns:ns="http://www.opera.com/"><ns:q>Hi
>  there</ns:q></ns:p>
>   var ns = new Namespace("http://www.opera.com/");
>   var em = "q"
>   document.writeln(x.ns::[em]);
>   </script>

I'm aware of E4X.  I meant: is it possible to refer to lexical
bindings in this manner in AS3?

I guess I don't see what use case is satisfied by this feature that
isn't already met by the existence of Map.  After all, the effect of
this feature is to turn lexical environments into (quasi) first class
maps, with the peculiar restriction that new name/value pairs cannot
be added, though existing ones can be mutated.  If a user actually
needs that functionality, it wouldn't be difficult to subclass Map to
get it.

And, yes, I know it's already possible to do this with lexically
scoped eval.  But why do you want to add another way to do it?

-Jon



More information about the Es4-discuss mailing list