4 ms·
One of the most powerful traits of concatenative programming languages is that implicit parameter passing through the stack makes it possible to factor any code
by RodgerTheGreat 16y ago
One of the most powerful traits of concatenative programming languages is that implicit parameter passing through the stack makes it possible to factor any code fragment into a new word that can act as a textual replacement. Anywhere you repeat a sequence of operations, you can factor it out. Most languages that use explicitly passed parameters make this more difficult as you have to start worrying about scoping and the "shipping and handling" of passing in arguments and unpacking results into a local scope.
I've linked this many times before, but I'm reminded of "Thinking Forth"[1], an excellent discussion of application architecture. It specifically deals with the Forth programming language, but carries lessons that are applicable to almost any language. I think the reason it works so well is because you can easily demonstrate factoring with a very short piece of Forth. In a language like C or Java you would need comparatively more involved examples to demonstrate the same principles.
[1] http://thinking-forth.sourceforge.net/ http://thinking-forth.sourceforge.net/