mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 23:23:37 +01:00
For generators are eager in values, but should be lazy #130
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bioball on GitHub (Apr 5, 2024).
Here,
y["two"]should be 4, not 3.for (v in x) {}should iterate over lazy values, andfor (k, v in x) {}should iterate over eager keys and lazy values.@odenix commented on GitHub (Dec 7, 2024):
In my mind, lazy evaluation of
vmeans thatx[k]is only evaluated if and whenvis accessed. However, this won't change the resulting value.What you seem to be arguing for is some kind of macro expansion, i.e., replace every occurrence of
vwith the definition ofx[k]rather than the value ofx[k]. Why would this be desirable? At first sight it seems impossible to comprehend.