Join Nostr
2025-08-21 18:14:55 UTC
in reply to

typeswitch on Nostr: the advantage of using separate return and data stacks is that we can take any code ...

the advantage of using separate return and data stacks is that we can take any code that uses just the data stack and factor it out, e.g.

: add-thirty 30 + ;

is a forth word that adds 30 to the value on top of the data stack. but the corresponding "return stack oriented" version is not 30 >r plus, because calling a word puts the return address on the return stack. you'd have to wrap the definition with a return stack pop (r>) and a push (>r) as so,

: add-thirty r> 30 >r plus >r ;