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

View Raw

More Information

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

Should stack values be modeled as quotations?

Now that Swanson is concatenative, it operates on a stack of values. I want it to be possible for those to be nested: that is, you can have a stack _as a value_ in another stack.

In typical concatenative languages, a _quotation_ (an abstracted-over piece of concatenative code) is the _same thing_ as a stack value. But that's largely because, like the lambda calculus, there are no other kinds of value! Every piece of data your program operates on must be Church-encoded: into a stack value for a concatenative language, or into a lambda term in the lambda calculus.

How would this work in a _linear_ language like Swanson? The cases for and against:

Stack values cannot be quotations

Stack values can be quotations

Decision

In Swanson, stack values are a distinct thing, and are not modeled as quotations. Partly so that we can come up with a linear basis of Sâ‚€ instructions that manipulate stack values.

A linear basis for Swanson

..