On Oct 13, 2008, at 4:54 PM, Waldemar Horwat wrote: > I am talking about let bindings. Lars brought up at that meeting. > I did not find the use cases particularly convincing, but the dead > zone is compelling. There are four ways to do this: > A1. Lexical dead zone. References textually prior to a definition > in the same block are an error. > A2. Lexical window. References textually prior to a definition in > the same block go to outer scope. > B1. Temporal dead zone. References temporally prior to a definition > in the same block are an error. > B2. Temporal window. References temporally prior to a definition in > the same block go to outer scope. > > Let's take a look at an example: > > let x = "outer"; > function g() {return "outer"} > > { > g(); > function f() { ... x ... g ... g() ... } > f(); > var t = some_runtime_type; > const x:t = "inner"; > function g() { ... x ... } > g(); > f(); > } > > B2 is bad because then the x inside g would sometimes refer to > "outer" and sometimes to "inner". > > A1 and A2 introduce extra complexity but doesn't solve the problem. > You'd need to come up with a value for x to use in the very first > call to g(). Furthermore, for A2 whether the window occurred or not > would also depend on whether something was a function or not; users > would be surprised that x shows through the window inside f but g > doesn't. > > That leaves B1, which matches the semantic model (we need to avoid > referencing variables before we know their types and before we know > the values of constants).
Agreed, this is compelling, it shows the insufficiency of lexical order. I missed this somehow (where are those meeting minutes? Still being vetted by TC39?). Thanks for restating it. /be _______________________________________________ Es-discuss mailing list Es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss