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

For generators are eager in values, but should be lazy #398

Open
bioball opened this issue Apr 4, 2024 · 0 comments
Open

For generators are eager in values, but should be lazy #398

bioball opened this issue Apr 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@bioball
Copy link
Contributor

bioball commented Apr 4, 2024

x = new {
  ["one"] = 1
  ["two"] = this["one"] + 1
}

y = (x) {
  for (k, v in x) {
    [k] = v + 1
  }
}

Here, y["two"] should be 4, not 3.

for (v in x) {} should iterate over lazy values, and for (k, v in x) {} should iterate over eager keys and lazy values.

@bioball bioball added the bug Something isn't working label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant