2 ms·
in ur-scheme i put the variables that are captured by closures into heap-allocated cells; both the original stack frame and the closures contain pointers to the
by kragen 4y ago
in ur-scheme i put the variables that are captured by closures into heap-allocated cells; both the original stack frame and the closures contain pointers to these cells, eliminating the circular references, but adding an additional indirection step to accessing those variables
theoretically this gives you more precise garbage collection, but it does give the collector more allocations to worry about
it also allows you to use a traditional stack for your stack, rather than a bunch of heap-allocated things, and that's probably a win