3 ms·
> Variables have to go somewhere. As I already mentioned, in Forth you barely need variables. Everything happens on the stack. The rest is global. Forth requi
by progman 10y ago
> Variables have to go somewhere.
As I already mentioned, in Forth you barely need variables. Everything happens on the stack. The rest is global.
Forth requires a radical shift in thinking about programming. You should read Leo Brodie's book "Thinking Forth".
http://thinking-forth.sourceforge.net/ http://thinking-forth.sourceforge.net/
> Good luck finding them amidst all the confusing rolling, picking, duping, etc.
Good Forth code style uses comments all the time. For instance:
( swap the two top values )
: myswap ( x y -- y x) <= x y is input, y x is output
swap ( y x ) ;
If you keep every Forth routine small then you can really have fun in Forth without local variables.
By the way, I would never use Forth for big software. Forth is particularly powerful in tiny systems where every byte matters.