Block scoping and redeclarations

Andreas Rossberg rossberg at
Thu Aug 25 23:54:54 PDT 2011

On 25 August 2011 18:57, Brendan Eich <brendan at> wrote:
> 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?).

Well, in that case you would not capture the order-independence
properly. Consider e.g.:

  { { var x; ... let x} }

Neither is the var hoisted "across" the source position of the let,
nor "across" its scope. Still it's supposed to be an error.

I'm not being entirely academic here. It's exactly details like this
that crop up when you try to implement (and, presumably, specify)
those rules, and they require some ugliness if you want to resolve
everything in one pass.


More information about the es-discuss mailing list