]> Witch of Git - ivy/commit
Implement variable capture
authorCassie Jones <code@witchoflight.com>
Sun, 1 Mar 2020 20:15:16 +0000 (21:15 +0100)
committerCassie Jones <code@witchoflight.com>
Sun, 1 Mar 2020 20:15:16 +0000 (21:15 +0100)
commit1b50778271f4537514fcb02c0a12e36262d71070
tree239aceff70758927a3b2be892f10533191415eaa
parent221fc2361404ed0a668c7946ba771bdd361de754
Implement variable capture

We just copy the variables into the closure environment after it gets
allocated. This involves a decent chunk of stack traffic because we have
to increment their reference counts.

In the process, I figured out that the "ivy_app_mut" optimization for
later functions isn't sound in the presence of nested functions, because
one of the earlier applications can return a shared function which isn't
acceptable to mutate. (There are ways to make it sound if you know for
sure what functions are being called).
ivy-examples/break.vy [new file with mode: 0644]
ivy-examples/minimal-captures.vy [new file with mode: 0644]
ivy-examples/program.vy [moved from program.vy with 100% similarity]
ivy-examples/sixty-four.vy [moved from sixty-four.vy with 50% similarity]
src/trans/x64.rs