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

let definitions can be accessible to run outside of their intended scope #2245

Open
TheBizzle opened this issue May 13, 2024 · 0 comments
Open

Comments

@TheBizzle
Copy link
Member

TheBizzle commented May 13, 2024

to setup
  if true [
    let a 2
  ]
  carefully [
    run "print a"
  ] [
    print error-message
  ]
end
  • Steps to reproduce: Run setup, using the code above
  • What should happen: Printing an error message
  • What actually happens: Printing 2

a should only be scoped to its if block. It seems as if it is getting lifted up to the entire procedure's context, and remains accessible in the run's context.

This strikes me as a minor issue. It's not clear that anyone has a real model that is broken by this. Any problems should be easy for users to work around by renaming a variable or two.

The issue affects both desktop and NLW. Issue #24 seems semi-related. Reported by user tiaotiao on the NetLogo Forum.

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