3 ms·
Stack architectures (at least Forths) typically have multiple stacks, which tend to make both locals and stack shuffling hell unnecessary most of the time. In g
by evincarofautumn 12y ago
Stack architectures (at least Forths) typically have multiple stacks, which tend to make both locals and stack shuffling hell unnecessary most of the time. In gforth for example, you can use the return stack to retain temporaries:
: expr1 1 ;
: expr2 2 ;
: f * ;
: test
expr1 expr2 2>r \ retain both results temporarily
2r@ + \ copy both to data stack as needed
2r@ -
2r@ f
2rdrop \ dispose of temporaries
;
test .s \ 3 -1 2