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

I have just spent a month writing about 2000 lines of Forth. My answer is no, at least w/r to generating something that looks like the by-hand code I wrote. LLMs coast by on being able to reproduce idiomatic syntax and having other forms of tooling(type checkers, linters, unit tests, etc.) back them up.

But Forth taken holistically is a do-anything-anytime imperative language, not just "concatenative" or "postfix". It has a stack but the stack is an implementation detail, not a robust abstraction. If you want to do larger scale things you don't pile more things on the stack, you start doing load and store and random access, inventing the idioms as you go along to load more and store more. This breaks all kinds of tooling models that rely on robust abstractions with compiler-enforced boundaries. I briefly tested to see what LLMs would do with it and gave up quickly because it was a complete rewrite every single time.

Now, if we were talking about a simplistic stack machine it might be more relevant, but that wouldn't be the same model of computation.





> It has a stack but the stack is an implementation detail, not a robust abstraction.

Not exactly. Not only the stack is central in the design of Forth (see my comment over there [1]).

It seems to me that a point-free language like Forth would be highly problematic for an LLM, because it has to work with things that literally are not in the text. I suppose it has to make a lot of guesses to build a theory of the semantic of the words it can see.

Nearly every time the topic of Forth is discussed on HN, someone points out that the cognitive overload* of full point-free style is not viable.

[1] https://news.ycombinator.com/item?id=46918824#46921815


I didn't finish my second sentence: not only the stack is a central element in the design of Forth, it also has 2 of them: data stack and return stack. the return stack is also used directly by programmers.



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

Search: