3 ms·
What you don't get in FORTH is arity information from the syntax, because everything is simply treated as a function from stack to stack. Unfortunately it's no
by zozbot234 5y ago
What you don't get in FORTH is arity information from the syntax, because everything is simply treated as a function from stack to stack. Unfortunately it's not feasible to keep the cleanliness of the FORTH syntax while providing that info (one would need a 2D view for that, where multiple arguments to the same function can be seen in parallel) so a parens-based syntax is arguably the next best choice.
- samatman 5y agoThe other thing you can't do (straightforwardly at least) is push a word onto a stack or apply it against some kind of compound structure. That's what I mean by Forth words not really being functions, they're subroutines for sure, and you can do some surprisingly powerful metaprogramming given that what you have is a glorified linked list, something a little more powerful than GOSUB, and two stacks, but functions? When you compare it with a visually similar concatenative language like Factor or Joy, which inarguably have functions, Forth words look pretty different.