¶Stack values cannot be quotations
2023-09-17
Thinking more about how to handle “stack values” in Swanson, which we've already decided should be first-class.
As things currently stand, a stack value is isomorphic to a single-branch quotation that pushes the contents of the stack value onto the working stack.
In a non-linear stack language, those two things are not just isomorphic — they're actually the same thing in the language. There is no distinct stack value, there are only quotations. The quote primitive pops a value off the stack and creates a quotation “containing” the value.
In a linear language like S₀, there needs to be a clear distinction between values, which absolutely must be handled or consumed (precisely once) at some point; and actions, which do not necessarily have to be executed. (In a linear language, every value must be consumed, but you (or your program) have agency to determine at run time how that consumption happens.)
That means that we can't conflate stack values and quotations, and need them to be distinct in the underlying calculus.