Hacker News
points by jacquesm 2 days ago | 0 comments
It's not complex, it is just that it requires a different mental model because of the lack of named parameters. Stack offsets are harder to remember than things with names, more so because they change all the time as you push and pull data.
[–] MaxBarraclough 1 day ago
Like many languages, Forth can get complicated if you really get into the weeds. These 2 papers [0][1] (both by one of Gforth's creators) illustrate the sorts of intricacies you can run into. The trickier subtleties have to do with Forth concepts like interpretation and compilation (which have their own meanings in Forth), and have little to do with Forth's use of stacks.

In Forth's defence, other languages also have tricky subtleties, e.g. C++. Neither language prioritises theoretical purity, of course. They would be very different languages, with different drawbacks and advantages, if they did.

Both papers touch on whether the behaviours of certain unusual Forth constructs are well-defined according to the ANS Forth language standard. This sort of discussion should be quite familiar to C++ programmers.

[0] State-smartness - Why it is Evil and How to Exorcise it (Ertl, 1998) http://www.euroforth.org/ef98/ertl98.pdf

[1] State-smartness: Applications, Pitfalls, Alternatives (Ertl, 2001) https://www.complang.tuwien.ac.at/papers/ertl01state.pdf

[–] jacquesm 1 day ago
I just implemented an ANSI compatible Forth so I'm reasonably familiar with those nasty bits, the 'DOES>' and 'DEFER' words in particular were interesting and caused me to have to rewrite some stuff that I had assumed was already stable.