Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement lexic scope #327

Open
jespa007 opened this issue Feb 27, 2022 · 0 comments
Open

Implement lexic scope #327

jespa007 opened this issue Feb 27, 2022 · 0 comments
Assignees

Comments

@jespa007
Copy link
Owner

like javascript does, local function inside functions captures all local variables and it stores in a "environment" as extern scope,

Example,

function f1(){
  var i=0;

  return function(){
        i++;
        Console::outln(i)
  }

}

var f=f1();
f(); // <-- it prints 1
f();// <-- it prints 2

So if the variable is not found as local, then it tries to find it in its environment.

@jespa007 jespa007 added this to the ZetScript 2.1.0 milestone Feb 27, 2022
@jespa007 jespa007 self-assigned this Feb 27, 2022
@jespa007 jespa007 removed this from the ZetScript 2.1.0 milestone May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant