link July 25 2012 Meeting Notes
Present: Mark Miller (MM), Brendan Eich (BE), Yehuda Katz (YK), Luke Hoban (LH), Andreas Rossberg (ARB), Rick Waldron (RW), Alex Russell (AR), Tom Van-Cutsem (TVC), Bill Ticehurst (BT), Rafeal Weinstein (RWS), Sam Tobin-Hochstadt (STH), Allen Wirfs-Brock (AWB), Doug Crockford (DC), John Neumann (JN), Erik Arvidsson (EA), Dave Herman (DH), Norbert Lindenberg (NL), Oliver Hunt (OH)
link Scoping Rules for Global Lexical Declaration
AWB:
Global scoping var vs. let and const declarations var and function need to go on global object
What do we do with new binding forms? (class, module, imports, let, const) Q. Should these become properties of the global object?
DH: Not sure a restriction is needed, the global scope is the global object in JavaScript. With modules, globals are less of a problem.
YK: (clarification)
AWB, DH, BE: (providing background, e.g. on temporal dead zone for let/const/classs
BE: Agree there needs to be some form of additional info not in property descriptor
ARB: Need additional static scope information e.g. for modules. Need additional dynamic information for temporal deadzone.
DH: If you drop the idea that let is always let everywhere. Questions whether let should be more like var at global scope.
ARB: Does not work for modules.
AR: Reasonable to say that the global scope is never finished and that properties can continue to be defined
AWB: An example.
A const declaration; it creates a property on the global object; it's not defined yet; Before it's initialized another piece of code sets the value - what happens?
DH: (board notes)
- 2 Contours, Nested "REPL"
- var, function go in global
- let, const, module, class... all get modeled lexically as usual in inner contour
- each script's inner contour is embedded in previous script's inner contour
- 2 Contours, Not Nested "Uniform Let"
- var, function, go in global
- let, const, module, class... all get modeled lexically as usual in inner contour
- each script's inner contour is "private" to that script
- 1 Contour, Global "Traditional"
- var, function, let, const, module, class... everything is a property of the global object.
- Additional scope refs in a side table of global, shared across scripts
- each script updates the side table
- 2 Contours, Not Nested - Merged "Expando"
- var, function, go in global
- let, const, module, class... all lexical
- each script updates lexical contour of previous scripts
AWB: "Expando" was previously agreed upon, where the additional layer of lexical scope is available but shared. (Notes that Andreas did not buy into this)
DH: Agrees. Explains where "Expando" fixes the problems of "Traditional".
1
2
3
4
5
6
|
|
This would identify that "x" was declared with "let" and so forth.
STH:
A.
1
2
3
4
5
6
|
|
"Expando" (#4) Makes this an error
link B.
1
2
3
4
|
|