Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upLexicalEnvironment and VariableEnvironment slots [ES5.1] #1056
Comments
littledan
added
the
question
label
Dec 28, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
littledan
Dec 28, 2017
Member
It's a bit subtle, but VariableEnvironment is important to implement the way that var declarations are hoisted out of blocks. See the note in 13.3.2 Variable Statement. On the other hand, LexicalEnvironment is used to implement detailed block scoping and variable lookup. I can understand if the notes here are a bit difficult to read; if you have any editorial suggestions for how to organize them to be more apparent, that would be welcome.
|
It's a bit subtle, but VariableEnvironment is important to implement the way that |
littledan
closed this
Dec 28, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
dSalieri
Dec 29, 2017
Yes, I read this note. But I did not learn anything new for myself. Yes in ES6 appeared let and const that complicated the ECMAScript architecture. By notes of variable declarations it is visible that it is written down in LexicalEnvironment, and that in VariableEnvironment.
-
In the specification it is said that LexicalEnvironment and VariableEnvironment are initialized by the same value - they contain the same content when entering in the execution context. Further only LexicalEnvironment can change, but not VariableEnvironment. If I correctly understand let and const declarations make LexicalEnvironment different from VariableEnvironment?
-
Can you give an example with a pseudo-code where you can not do without VariableEnvironment? In another way, I do not know how to comprehend the meaning of these two slots without an example on a pseudo-code or an explanation in which moments you can not do without VariableEnvironment, where it is very important!
dSalieri
commented
Dec 29, 2017
|
Yes, I read this note. But I did not learn anything new for myself. Yes in ES6 appeared let and const that complicated the ECMAScript architecture. By notes of variable declarations it is visible that it is written down in LexicalEnvironment, and that in VariableEnvironment.
|
dSalieri commentedDec 28, 2017
Why do we need LexicalEnvironment and VariableEnvironment if we can use one slot of them. When operations with LexicalEnvironment occur, then its contents are stored in a special variable and then the content of the special variable is given to the LexicalEnvironment slot. Not once in the specification there is no interaction between LexicalEnvironment and VariableEnvironment. VariableEnvironment is used only to create bindings and more and more it is not found anywhere. Explain the meaning of these two slots if there is no interaction between them. Need clarity here!