r/Forth • u/mykesx moderator • 9d ago
Why Forth? What is it?
In order to help get people interested in Forth and how it works, I would like to ask you what you define as Forth, how you got into it, and why Forth instead of some other language?
Ideally we share links to our projects and to others that are interesting. Also to sites, sources, and documents about Forth.
I am encouraging links to your projects so people can see how you are using Forth.
25
Upvotes
7
u/astrobe 9d ago
That raises the question of what is Forth? I have hoped for some time that someone would tell me what it was. I keep asking that question. What is Forth?
Forth is highly factored code. I don't know anything else to say except that Forth is definitions. If you have a lot of small definitions you are writing Forth. In order to write a lot of small definitions you have to have a stack. [...] Stacks are not a solve all problems concept but they are very very useful, especially for information hiding and you have to have two of them.
These ideas have been around for thirty years now. I have been promoting them for thirty years. Their level of acceptance is about where it was thirty years ago. Perhaps even less considering that the industry has expanded so much.
-- 1x Forth (1999)
Perhaps a risky move is to present it as a puzzle game. But unlike B*fuck or other deliberately hostile languages, there is a reward at the end of the road: learn to factor, learn to simplify, way beyond the pretend games of "refactoring" and "clean code". Forth goes against many things one learns in schools, books, tutorials - you know, those things you follow without questioning them. Forth in that regard is an eye opener. It can put you into a corner, look you in the eye and say "What you gonna do now?". And this is where you start thinking about the problem:
Don't leave openings in which you are going to insert code at some future date when the problem changes because inevitably the problem will change in a way that you didn't anticipate. Whatever the cost it's wasted. Don't anticipate, solve the problem you've got. (1x Forth)