Live data from Hacker News

What the hell is Forth? (2019)

blog.information-superhighway.net

31–40 of 138 posts

Re: What the hell is Forth? (2019)

#31

> A single person should be able to understand a computing system in its entirety, so that they can change it to fit their needs This idea combined with the notion that software written by someone else necessarily serves their purposes rather than yours has me gradually working in that direction. Really all I need to do is write (or run) a forth on some bare metal. It's fun to build your own hardware as well which is…

The part about the language being a little bootstrap and then mostly implemented in its own language... Are there other languages like this? At least any mainstream ones?

Well, Norvig's (et. al.) JScheme - http://norvig.com/jscheme.html - is implemented in Java - partially, and then a bunch of core functions are written in JScheme itself.

Or, if you look at implementations of J... like this - https://code.jsoftware.com/wiki/Essays/Incunabulum - it's basically creates something closer to J in C and then writes the rest of the interpreter. If you squint hard enough...

Re: What the hell is Forth? (2019)

#33
post #5

I believe that any programmer should at least know a little about Forth. It's like Lisp. Just knowing about them is extremely enlightening, even if you don't use them in your daily life. Obligatory link: https://github.com/nornagon/jonesforth/blob/master/jonesfort... This well-written tutorial will have you implement a Forth in 500 lines of assembly and another 500 lines of Forth. You will feel like a different perso…

Agree with the parent, it's a language worth knowing like LISP is worth knowing, but (unlike LISP) it is not a good language choice for almost all use cases in 2023 (almost all use cases are not that memory constrained any more, even embedded systems), for the same reason you shouldn't use Perl (it is very hard to read code). I was going to say "its main disadvantage is that the only way to find out what a piece of c…

  > for the same reason you shouldn't use Perl (it is very hard to read code)
I slightly disagree with this take on Perl. Agreed that it is easy to write code which is hard for others to read, and agreed that it is often not a good idea in a large-team setting, for that reason.

But there is a lot of code that doesn't fall in that category, and Perl, by its nature (and by CPAN), can be remarkably good at just "getting stuff done" for oneself. All the wild syntax can really help in expressing a concept succinctly.

I wouldn't say the same about Forth, though.

Re: What the hell is Forth? (2019)

#34
post #5

I believe that any programmer should at least know a little about Forth. It's like Lisp. Just knowing about them is extremely enlightening, even if you don't use them in your daily life. Obligatory link: https://github.com/nornagon/jonesforth/blob/master/jonesfort... This well-written tutorial will have you implement a Forth in 500 lines of assembly and another 500 lines of Forth. You will feel like a different perso…

Agree with the parent, it's a language worth knowing like LISP is worth knowing, but (unlike LISP) it is not a good language choice for almost all use cases in 2023 (almost all use cases are not that memory constrained any more, even embedded systems), for the same reason you shouldn't use Perl (it is very hard to read code). I was going to say "its main disadvantage is that the only way to find out what a piece of c…

> it is not a good language choice for almost all use cases in 2023

I think I agree with this. But it’s fun to think about wild scenarios where it would make sense.

Like some dystopian future where people are trying to cobble found hardware together to make something.

Re: What the hell is Forth? (2019)

#35

This is a great article! I love his description of Forth as "a weird backwards lisp with no parentheses". Reading the source code of "WAForth" (Forth for WebAssembly) really helped me learn about how WebAssembly works deep down, from the ground up. It demonstrates the first step of what the article says about bootstrapping a Forth system, and it has some beautiful hand written WebAssembly code implementing the primit…

Here's the author's blog post about WAForth:

A Dynamic Forth Compiler for WebAssembly

https://el-tramo.be/blog/waforth/

Re: What the hell is Forth? (2019)

#36

i had a room mate in the early 90's who was a forth programmer. At the time they wrote the code that did the airport displays. It was all forth. I wrote c back then and never really grasped it. Always seemed a little like a weird assembler.

It’s a meta-assembler. You can see every word you define as a new instruction you define. For example, if you want an instruction that multiplies by 17, you do

  : 17* 17 * ;

Re: What the hell is Forth? (2019)

#37
wow!!! This bring me a lot of memories. Back in 1988, I wrote a Forth program to control a X-Y table to control a ultrasound probe to inspect metal parts. The program was running on a Radio Shack Color Computer 2 (TRS-80) with 16k of RAM. The program itself was running in OS-9 operating system. Remember, there was no hard drive on this, only one floppy drive! Amazing to see how far we come from!

Re: What the hell is Forth? (2019)

#38
post #3

I believe that any programmer should at least know a little about Forth. It's like Lisp. Just knowing about them is extremely enlightening, even if you don't use them in your daily life. Obligatory link: https://github.com/nornagon/jonesforth/blob/master/jonesfort... This well-written tutorial will have you implement a Forth in 500 lines of assembly and another 500 lines of Forth. You will feel like a different perso…

I've also heard it cures cancer. Any truth to this?

CHECK FACTH FIRTH YOUR

Re: What the hell is Forth? (2019)

#39

> A system does not have to be complex to be flexible, extensible, and customizable An important lesson that many teams and orgs still haven't internalized. Maybe one day it'll be more commonly understood.

Complexity frequently doesn't come from the logical requirements of the system, instead it comes from the need to integrate the system to the VERY COMPLEX environment where it resides. Any simple web system nowadays needs to integrate with a complex web environment, with dozens (if not hundreds) of protocols, OS layers, databases, just to begin with. This is why you need hundreds of thousands of lines (or equivalent libraries) to create the simplest funcional application these days.

The secret of Forth is to avoid the environmental complexity by creating a language that is so simple that it barely needs any support and any integration with other systems. This is also its major weakness for commercial use.

Post reply on HN