Data Stack¶
A Succint Stack Description by Dave Wyland¶
The data stack is the unusual part of Forth. It’s primary function is to pass operands to and from the Forth words. You use the stack for the parameters rather than enumerating them explicitly in the call structure as is required in almost all languages from Fortran to C and onward.
- It turns out that the stack is not a bug, it is a feature. It has benefits:
You do not have to name your parameters to pass them. for example, a parameter on the stack can be (and often is) the un-named result of a previous calculation.
You do not have to name your parameters to manipulate them. Languages that use equations to calculate and move data require that each piece of data be named, even if it is a temporary variable for one-time use. This clogs up the name space, and it does so approximately in proportion to the size of the program in lines of code. [Dave-Wyland]