Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!tektronix!tekcrl!tekgvs!toma From: toma@tekgvs.LABS.TEK.COM (Tom Almy) Newsgroups: comp.lang.forth Subject: Re: Multiple Stacks Message-ID: <5220@tekgvs.LABS.TEK.COM> Date: 25 May 89 17:53:31 GMT References: <442@mtk.UUCP> Reply-To: toma@tekgvs.LABS.TEK.COM (Tom Almy) Distribution: usa Organization: Tektronix, Inc., Beaverton, OR. Lines: 19 In article <442@mtk.UUCP> marmar@mtk.UUCP (Mark Martino) writes: >When is it useful to implement additional stacks? What characteristics >of a programming problem suggest that multiple stacks would be a good >solution? > Well, STOIC (a variant of Forth) had separate "Loop" and "Return" stacks. That way you could access values on the Return stack (which, like Forth, is commonly used as a second parameter stack) easily from within a loop structure. I have used the 8087 internal floating point stack in Forth. It's actually easier to use floating point when the values are on a separate stack since you don't have to figure out how to (for instance) swap a float (is it 32 or 64 bits?) with an integer (is it 16 or 32 bits?). I have also seen string stacks, but I find them inefficient. Tom Almy toma@tekgvs.labs.tek.com