3 ms·
I know Forth, and I think it escapes the whitespace vs. delimiters dilemma by "cheating" in a very elegant but uninteresting way: manipulating the stack at runt
by HelloNurse 7y ago
I know Forth, and I think it escapes the whitespace vs. delimiters dilemma by "cheating" in a very elegant but uninteresting way: manipulating the stack at runtime instead of munging strings and syntax trees at compile time, so that abstractions that would be macros in Lisp-style languages or relatively complicated classes, functions etc. in mainstream procedural languages can be a much simpler DSL of words that just do something to the stack and other execution state, without the burden of other concepts and representations.
- thaumasiotes 7y agoIn my mind, Forth "escapes" the whitespace-vs-delimiters issue by not having variadic functions. Forth code is more or less a direct transcription of the parse tree in the same way that lisp is, just postorder instead of preorder. And if you eliminated variadic functions from lisp, you wouldn't need its parentheses either.
- gmfawcett 7y agoI haven't Forthed in a long time, but you can write variadic words (e.g., "keep popping until a negative number is reached"). You just (a) shouldn't, probably; and (b) can't document their stack effect properly.