Hacker News
points by Hendrikto 3 days ago | 0 comments
Some sorely needed context:

> [Gforth is] a free, fast, featureful and portable implementation of the Forth 2012 language.

> Gforth runs under GNU, BSD, and similar systems, MS Windows and MacOS X and should not be hard to port to other systems supported by GCC.

[–] daitangio 2 days ago
If you love HP-RPN calculators, you may love Forth as well. Forth is a very interesting language, I find it a bit too complex for my little brain but give it a spin if, you have 2 free hours
[–] mitxela 2 days ago
For me, the most interesting thing about Forth is it's "thin-ness". Getting from machine code to a Forth REPL can take about 4 kilobytes.
[–] jnpnj 2 days ago
Same, people often described it as the lisp of assembly. You get a lot of freedom of abstraction over almost direct bare metal.
[–] sramsay 1 day ago
Yes. Or "Lisp for hardware nerds." ;)
[–] jacquesm 2 days ago
Exactly, and if you build your inner interpreter properly it is wicked fast.
[–] jacquesm 2 days ago
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 2 days 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.