Strict mode recap

Jon Zeppieri jaz at bu.edu
Fri Apr 4 11:24:09 PDT 2008


On Fri, Apr 4, 2008 at 1:45 PM, Lars Hansen <lhansen at adobe.com> wrote:
>
>  That could be true.  But it could also be the case that people
>  find that it is easier to say
>
>   var x = ...
>   var y = ...
>   var n = "x"  // but could be y
>
>   ...
>   // n may change here by assigning another string to it
>   ...
>   eval(n)
>
>  than
>
>   var x = ...
>   var y = ...
>   var n = function () { return x } // but could be y
>
>   ...
>   // n may change here by assigning another function to it
>   ...
>   n()

Like I wrote in previous messages, what these programmers need is an
actual data structure:

var m = { x: ..., y: ... };
var n = "x";

// n may change, &c.
...
m[n]

>
>  (and the latter does not handle shadowing, for better or worse).

Heh.  Someone should revive Mark Miller.

-Jon



More information about the Es4-discuss mailing list