# RE: [stack] Re: Abstraction again

## wtanksley@bigfoot.com — 2000-10-24 20:24:12

    From: Mark van Gulik [mailto:ghoul6@...]

     >Manfred (phimvt@...) wrote:

    >Then again, since being able to manipulate things in something

    >other than

    >stack order seems essential to a Joy programmer's sanity, why

    >not simply

    >introduce one more stack?  Here's a proposal for a language

    >using two (data) stacks...

     You might want to look at Forth, which does almost exactly this (except that

    it doesn't implement dip at all, instead depending entirely on direct return

    stack manipulations).  OTA (Open Terminal Architecture, a standard for smart

    cards) is based on Forth, and defines both a return stack and a stack frame

    stack, used to store local variables.

    Oh, I forgot about local variables.  The things you call 'lambda

    abstractions' are called 'local variables' in Forth, and are defined in the

    ANSI standard.

     >    3 4 5 [x y z] [[a m z] print-my-favorite-letters]

    >Do we really not want to allow uses of z as a "free variable"

    >inside these

    >quotations?  I actually vote against allowing *any* free

    >variables (like, totally Prenix normal, dude), but that's

    >another story.

     Another variant (which I've suggested before) is to only allow stack symbols

    inside of abstractions, so this would be legal:

     (% x y z)(x x y z)

    but this would be disallowed:

     (% x y z)(x dup y z)

    I wrote mine as

     xyz--xxyz

    which makes the restriction perfectly clear, and which also permits the

    programmer to see that the operation is simply a stack order combinator, not

    a special syntax.

     >Mark

     -Billy