2 ms·
FORTH ?KNOW IF HONK! ELSE FORTH LEARN! THEN I love Forth: I don't use it any more, but I'm glad I used it a lot in the past. Programming in Forth is like doin
by SimHacker 13y ago
FORTH ?KNOW IF HONK! ELSE FORTH LEARN! THEN
I love Forth: I don't use it any more, but I'm glad I used it a lot in the past.
Programming in Forth is like doing power push-ups with weights, that make you stronger when you're programming in other languages.
It's a "glass box" and you just have to (and CAN, because it's so minimal) memorize not only the name, inputs and outputs of every word, but even recite their implementations in terms of other Forth words. It's simple and elegant enough that you can understand and get your head around the entire system, in terms of itself!
And then when you're writing code, you also have to remember what is on your stack between every word, which changes with every word, or you write explicit stack comments at the end of every line to keep track of them, if you're weak.
After Forth, programming in other higher level languages that let me (gasp) name my variables so they would stay in one place and be associated with meaningful symbols, instead of having to carry them around in my head and and shuffle them around on the stack, it was like slicing butter with a hot knife!
I did a lot of PostScript programming after Forth, but that was easy because PostScript has dictionaries that you can use for local scopes (and which can be used to implement a multiple inheritance object system like smalltalk's), so naming variables is acceptable, and you could keep the stack pretty shallow. Plus PostScript is just a lot more like Lisp than it is like Forth.
- evincarofautumn 13y agoForth is basically at the level of an assembly language, but somehow it feels much more high-level and flexible. Having written a bunch of x86 and some Forth, I would say Forth is more pleasant to use once you’ve gotten over the small initial hump of stack-based programming. And anyway, if you write your functions correctly, the stack becomes an implementation detail. It definitely affects your thinking in higher-level languages, though—naming bits of state ends up seeming way less necessary than naming and composing behaviours. I’m writing a statically typed functional stack-based language called Kitten, in which the type system and local variables help you work compositionally and avoid managing the stack. It’s not yet ready for prime time, but you might be interested in following its development. Check it out! [1]: http://github.com/evincarofautumn/kitten http://github.com/evincarofautumn/kitten [2]: http://kittenlang.org/ http://kittenlang.org/
- SimHacker 13y agoOne thing I love about Forth is that the Forth assembler is implemented in the same spirit as the Forth compiler, which is to say that it's fully integrated and programmable and extensible in Forth! So it has much more than a "macro" facility -- you can write full-fledged Forth assembly macros that assemble any code you like programmatically! And write your own assembler flow control constructs, and stuff like that!