pkl icon indicating copy to clipboard operation
pkl copied to clipboard

For generators are eager in values, but should be lazy

Open bioball opened this issue 3 months ago • 0 comments

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 avatar Apr 04 '24 23:04 bioball