💾 Archived View for dcreager.net › swanson › stack-values-cannot-be-quotations.gmi captured on 2023-11-04 at 11:42:05. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-28)

🚧 View Differences

-=-=-=-=-=-=-

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.

Stacks 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.

Or maybe we can?

Stack values can be quotations

..