Comment by yellowapple
5 years ago
- It's tiny and dead simple to implement
- It sits very close to assembly
- It allows high-level programming like in C
- The concept of pushing/popping things onto/off the stack is a relatively straightforward programming model when done consistently
One of the old competitors to the likes of UEFI and uBoot is OpenFirmware (also known as OpenBoot), for which the primary UI is a Forth shell; OpenFirmware was the BIOS equivalent for Sun's SPARC workstations/servers (and still is for Oracle's/Fujistu's SPARC servers, last I checked) and most POWER hardware (including "New World" PowerPC Macs), among others. About the most delightful pre-boot environment I've used; it's a shame it didn't catch on in the x86 or ARM space.
In some ways it is even more abstraction-friendly than C because of how easy it is to manipulate functions or redefine its own interpreter/compiler. There was a nice example of a Tiny C compiler written in Forth by Marcel Hendrix posted to comp.lang.forth, with a Forth-defined VM as target. I posted a story about it at https://news.ycombinator.com/item?id=23455548
The big problem with Forth is software reliability: ad-hoc Forth code is hard to reason about in any generality. Languages like Factor show that dialects of Forth can be much better in this regard.
Also works great with graphics. PostScript is similar to Forth.
I got into Forth recently - using Gnu Forth - but got bogged down at my inability to do graphics. There are hardly any Forth programming videos of any kind online, besides the "101" kind, but I found one by a guy who managed to get graphics/windows going, I think with GForth. (Can't find it on youtube now.) Looked mega-complicated. So lately back into Tcl/Tk, which also satisfies my "bizarre, powerful and very cool language" itch but actually makes graphics/windows super-easy. I do think Forth is awesome though!
After getting into Forth I got into PostScript, which does have most of the Forth fun/freedom taken out of it. It's not usable for GUI-type programming is it?
Look at Sun NeWS and Display PostScript for GUIs written in PostScript (well...an extended PostScript).