Concatenative languages are very concise, because the "glue" between words (functions) is minimal; in effect, just whitespace. One line of concatenative code might call 6 words, and be equivalent to 6 lines of another language, because parameter names and variable bindings are omitted.
Concatenative languages encourage short definitions because there is very little syntactic overhead associated with creating a new word; any sequence of words can be "factored out" into a new definition. A common misconception is that they force you to write short definitions; this is not really true. Rather, they encourage you to write short definitions and re-use more code by not penalizing you if you choose to do so, and in practice most programmers choose to write short definitions and reap all the benefits this entails: code reuse, more opportunity to name and document, more exhaustive unit testing.
In fact, there is generally no reason to have any kind of repetition in your program whatsoever. Because definitions become short from high code re-use, and not from using obscure tricks of syntax, the shortest definition is often the most readable; which is exactly the opposite situation from applicative languages, especially syntax-heavy ones such as Perl. Short definitions have the added benefit of likely being more efficient, so with concatenative languages, good code sits in the rather large intersection between efficient, concise, and readable.
This revision created on Sat, 3 Jan 2009 01:35:12 by slava
All content is © 2008-2010 by its respective authors. By adding content to this wiki, you agree to release it under the BSD license.