Strict mode recap

liorean liorean at gmail.com
Thu Apr 3 20:54:42 PDT 2008


On 04/04/2008, Jon Zeppieri <jaz at bu.edu> wrote:
> This is like the E4X example in one crucial respect:  in both cases,
>  you're accessing a property of a first-class object.  I'm not arguing
>  against this use of computed names.  I don't see any significant
>  difference between the above and:
>
>  var obj = { x: "hello" };
>  print(obj["x"]);
>
>  My claim is simply that...
>
>  function foo() {
>   var x = "hello";
>  }
>
>  ... here, x is not a property of a first-class object.  x's binding
>  environment isn't a datum.  But:
>
>  function foo(name) {
>   ...
>   return null::[name];
>  }
>
>  ... treats the environment as if it were a datum.  I know that in the
>  ES3 spec all bindings are referred to as properties of objects, but
>  activation objects are only notional entities.  The current ES4
>  proposal seems to raise their status by giving programmers a simple
>  mechanism to (practically) reify them.

Except you can't actually make the activation object a first class
object. The null namespace (or any other namespace) is orthogonal to
the activation object - you can now look up local variables
dynamically instead of just statically, but the scope still cannot be
leaked out of the function in any way.

The only notable change is that you now have a method of making
dynamic lookup of the local variables in a scope instead of only
static lookup. The method of doing so is considerably better than
locally scoped eval because it's restricted to doing just that and
nothing more.
-- 
David "liorean" Andersson



More information about the Es4-discuss mailing list