dcreager.net

Staged stacks are just values

2023-11-02

Counterpoint to

Towers of stacks

Instead of baking the idea of staged stacks into S₀ itself, with each instruction taking in a delta indicating which stack it operates on, just have staged stacks be normal Swanson values. They would be quotations, that somehow encapsulate the current contents of the stack. Each S₀ instruction (which in this world, operates on the single runtime stack) would have an equivalent method that you could call on the staged stack value, which would have the same effect as the S₀ instruction applied to the encapsulated stack. Transferring values between the “real” runtime stack and the encapsulated stack (in either direction) would just be another method—one which doesn't have an analogue as an S₀ instruction.

Stacks should be first-class

..