Functions
Closures snapshot values
Here’s a bug JavaScript shipped for years: build a few functions inside a loop, each meant to remember the loop counter, and they all end up seeing the final value instead. JS had to add per-iteration let to patch it.
It can’t happen here, because an Ascent closure captures by value — it snapshots the names it uses at the moment it’s created:
Three functions, each built in a different turn of the loop. Call them afterward and you get [0, 1, 2] — the value i held when each one was created — not [3, 3, 3]. The closure remembers a value, not a live link back to the slot.
(The rare time you actually want a closure to track later changes, that’s Ref<T> — a value that holds a shared slot. Much later.)