| > Forth is an assembly language for a pretty low level stack-based virtual machine. (And such machines are very popular, though rarely programmed by hand.) Forth is indeed an assembly language for Forth processors, but Forth was never intended as some sort of intermediate language. It is a programming language for humans since 1970. It's interesting to note that, unlike Lisp machines and other language-X-processors who are now rusting in museums, "Forth processors" are still being launched in space [1]. So, to anticipated about what you say later, it must be a cosmic buffoon. Better than dying from a slightly cold winter I guess. > It's not a good VM for compiling dynamic languages Off topic, but why would you do that anyway? At some point, register-based VMs outperformed stack-based VMs due to the evolution of processors (cache, branch prediction, large register banks) and progresses in compilation techniques. Forth doesn't need to be "recycled" as a target language. It is useful enough for those who've practiced it long enough to understand its value proposition. > Forth is completely forgiving, like an old buffoon. Pass four arguments to a three-argument function? All is forgiven. Lua and Newlisp (and probably other Lisp variants) let you pass more arguments or less arguments to a function; you won't get any warning while the compiler/interpreter silently ignores the extra parameters or fills the missing parameters with nil. In Forth there are some ways to detect argument mismatches, but really nobody cares about those training wheels. The problem is solved in a different way. Also, many dynamic languages had to add a "strict mode" because letting people not declare identifiers is not so "user-friendly" after all... I'll trade any day a language that breaks on stupid typos for a language that breaks because I forgot to push a result. Actually, that's why I did. [1] https://en.wikipedia.org/wiki/RTX2010 |
ANSI Common Lisp and Scheme do not allow too many or too few arguments to be passed to a function.
Let's try CLISP:
Or: Unbound vars: > nobody cares about those training wheels.Error checking is for lesser programmers: very effective advocacy!
> The problem is solved in a different way
Exhaustive testing? The problem is that there isn't even a reliable dynamic check. A misuse of the data stack in one place can affect code elsewhere. Just because you step on the bug doesn't mean that the machine will halt with a diagnostic, let alone one that pinpoints the cause.