On 2010-07-14, at 8:40 PM, Maxime Chevalier-Boisvert wrote:
Marc, I don't really get the comment you added in ast-passes:
// TODO: the computation of clos_vars should be done elsewhere as it is not related to the semantics
Where else would you do this computation? It seems to me that it's logically related to the resolution of variable scopes. It's simply a more restricted free_vars set which doesn't include globals.
Exactly. The reason you don't include globals is because we will implement the global variables in a special way in the first version of the compiler (we have discussed this before). It is a modularity issue. You are putting in ast-passes.js (an early pass of the compiler) some knowledge of the runtime system (the way globals are accessed). But clearly clos_vars (which you need later on) can be computed from free_vars by removing the global variables. The benefits are: more modular code and less space usage (no duplication of information in free_vars and clos_vars).
Marc