Hacker News new | ask | show | jobs
by _krii 1440 days ago
I fell in love with FORTH recently and wrote a bare-metal "OS" (barely!) for the IBM PC based on it. Funny how people are mostly implementing Forths rather than writing programs in Forth. Why is this?

I looked to see what Chuck Moore was up to; he's in his 80s and still tinkering and chatting with fans of his work, as recently as late last year:

https://www.youtube.com/watch?v=dI0soDMg28Q

3 comments

My guess as to why people write their own forths is:

a. It's easy compared to writing a C complier (or even a half-way feature rich BASIC interpreter.)

b. The easiest way to understand some features of FORTH (like tick and var and colon) is to simply re-implement them.

So if you've already reimplemented half of the language, it's easier to reimplement the rest of it than to internalize how someone else's FORTH works.

I worked on a somewhat large FORTH project in the late 80s. My quip was: "The cool thing about FORTH is that it's so easy to extend the outer interpreter to make a DSL. The bad news is that someone on your project already has."

Good thoughts, thanks. This mirrors my own experience. The whole thing did seem very approachable to me. Pretty sure we had to implement a FORTH in a programming languages course I took back in college as well, so I had that basic familiarity with it.

Actually writing FORTH programs, on the other hand, is for me a real brain-bender. It seems to require a very different kind of thinking than does programming in C (for example).

> It seems to require a very different kind of thinking than does programming in C

That's the beauty of it. The more exposure you get to these kinds of different paradigms, the further you advance your craft. It all transitions to whatever you're working on and helps you better speak the fundamental computer language.

Same reason people write Lisps instead of working with Lisp: It's fun, but not all that useful when you are finished. In the modern world, you can't really do much other than simple demos without encryption and networking and those things are much harder to write than a Forth system.
Forth is great fun to play around with. I love the way you can extend the language to create new constructs. They're like Lisp macros with the safety catch off. I found it difficult to reason about how immediate words will be executed and embed code the way I want it to.

In the hands of an expert, Forth can look like a Haiku. For anyone else: not so much (to put it politely). In the end, I just want a solid programming language like C.

Forth advocates can also sound a bit mystical in their utterances, and how they need only 1% of the code of everyone else. They're like Zen riddles: universal truths that no-one really understands. Um, OK, they're undoubtedly right from their point of view, but I doubt that the developers of the Linux kernel wrote 99% of the code for no real reason.

I played with colorforth a couple of times, but could never figure out what the living fark was going on. Sure, it works for Charles Moore, but I'm not Charles Moore. I did see a guy on YT that actually used colorforth. He seemed really happy and productive with it, although I couldn't help but walk away with the sense that it was a bit of a mystery to him too.

I don't think that Forth is that great for microcontrollers either. C's model of edit-compile-upload gets the job done.

I think that the difference between Forth and conventional languages is this: you can write specific solutions to specific problems in Forth, whereas conventional languages are better at generality and scale. Each has their place, but the reason you'll see more of the general-purpose language artefacts is because, well, they're more general-purpose.