[ prog / sol / mona ]

prog


Stack effect type checking

8 2023-10-29 22:38

It seems to me that a concatenative language could be expressed as a form of function composition f∘g∘h∘... of words, with a recursive stack as their domain; for example + : Num Num [Stack] -> Num [Stack], so that we can match inputs and outputs of adjacent words. Checking the type would be a matter of keeping track of the type of the stack at al times, and to verify that at any point the word in question matches the input.
I don't think variable arguments and dynamic typing could work in this system. Maybe overloaded type signatures, or union types.

22


VIP:

do not edit these