On 16.04.2011 0:06, Brendan Eich wrote:
On Apr 15, 2011, at 9:56 PM, Sam Tobin-Hochstadt wrote:

1. The global object (which is what's originally under discussion
here) also gives you "dynamic scope" for top-level variables.
Right -- this is important and it is a deoptimer for optimizing 
implementations, but they can cope. The real problem is for JS hackers who 
cannot be sure their foopey typo (when they meant foopy) won't resolve to 
something else, accidentally or maliciously.

Sure, this is the issue, though this is already done (in strict mode) but as a runtime error; thus, dynamic bindings are kept (i.e it's possible to `this["foo" + bar] = 10`). Direct lexical addressing taking way the ability of `this["foo" + bar] = 10` provides those errors (of `nonExisting = 10`) to be compile-time error. That's it. But the issue which Sam and you mention is already solved. So that's why I said that the most important is the ability of the fast lookup.

2. Again, the reason that Dave and I have worked hard to avoid holes
in the lexical scoping of identifiers in modules is for programmers to
understand programs -- not for efficiency at all.  I don't know what
else to say to persuade you of this, but making identifier resolution
fast is not "the main reason".
Well, you've said it, that's enough on its face ;-).

Developers I talk to really want early error on typos, it's a no-brainer.

Right.

Dmitry, if you mean something other than revoking this win of Harmony lexical 
scoping, please correct me. Otherwise, I do not see any good in reinjecting the 
global object (directly or via some kind of proxy) onto the scope chain.



Nope, everything's fine and correct, I just was thinking (from what it's all started) that we'll not be able to expressively define some bindings directly in runtime depending on the condition, etc (as was shown in reply to David with isString, isArray, etc functions). And then we switch to the "what's the main reason?".

But of course to have all those errors as compile-time is a good improvement. And! Which allows to really optimize identifiers resolution (which IMO, ok, -- if not the first for you, but the one of the most important reasons of such an optimization) :P

Dmitry.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to