Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Macro/concatenative languages should replace the Forth line. The author is off-base in thinking RPN or stacks are important to Forth rather than concatenativity. RPN is just an easy way to make interpretation simple, an implementation detail, not a functional requirement. It would be like defining APL as being evaluated right-to-left.


The stack is important to Forth, but equally so is its threaded-subroutine-call nature, which isn't present in other early languages that I know of. That puts Forth halfway between assembly and higher-level (and easier to read) languages. I never saw it as a macro language.

At least that's the viewpoint I'm familiar with from back when we heavily used it.


What do you mean by threaded here?


https://en.wikipedia.org/wiki/Threaded_code

It's a way of structuring an interpreter. In forth a word is just a pointer to its definition, which in turn is just a list of pointers to other words, potentially user defined or built in primitives. Execution threads through these pointers, much like making subroutine calls with arguments being passed implicitly on the stack.

It's much more compact and lower overhead than a classic interpreter walking a full Abstract Syntax Tree structure. These days most languages are going to a full native code JIT however.


> What do you mean by threaded here?

Here's a good explanation.

https://www.bradrodriguez.com/papers/moving1.htm




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: