Block scoping and redeclarations

Brendan Eich brendan at mozilla.com
Thu Aug 25 09:57:10 PDT 2011


On Aug 25, 2011, at 6:17 AM, Andreas Rossberg wrote:

>> There is no "before and after" or "both" here. Hoisting first, with rule 1 enforced; then rule 2 checking. Relative source order of declarations is irrelevant.
> 
> <pedantic>Well, only when you're implicitly assuming a somewhat
> non-standard meaning of "across", as rather "across or from".
> Clarifying that amounts to the same thing.</pedantic>

Please don't over-formalize my words here, that would be a big mistake!

Hoisting is a very physical metaphor. Hoist that crate! By "across" I meant across the let declaration in its source position. Not "across" the let binding which is also hoisted (so I think I see what you mean by "across or from" -- do I?).


> Anyway, I'll rest my case. I remain somewhat unconvinced that the
> extra complexity is nil and worthwhile, but there obviously are more
> critical topics. We'll go ahead and implement the rules that you
> sketched above.

Thanks. Given the top-level has to accomodate var and let (for disjoint sets of names), it shouldn't be much more code to do the same in functions (rather than ban mixing of var and let for all names in functions).

/be


More information about the es-discuss mailing list