Live data from Hacker News

Levels of code in Forth programming (2002)

ultratechnology.com

1–10 of 53 posts

Re: Levels of code in Forth programming (2002)

#3
Before I learned Forth, I was very comfortable in Common Lisp. Now I miss the convenience when writing Forth and raw simplicity when writing Lisp.

I realize the problem isn't Forth, some people (such as the writer for example) are capable of pulling amazing feats for such a primitive tool.

But as a result, the programming languages [0] I've designed since have all been part Forth and part Common Lisp.

[0] https://github.com/codr7/cidk

Re: Levels of code in Forth programming (2002)

#4
Forth is pretty amazing. It really delivers on that old promise of “a language that will make you a better programmer in other languages”.

However, from my experience, since there is basically no syntax, all Forth programs tend to be a DSL for the problem at hand. It’s almost like having to learn a new language ok each new project. It’s like a complete opposite of what makes Go great.

Re: Levels of code in Forth programming (2002)

#5
Intriguing article. Just updated some Forth code for interfacing with an ADC on a sensor I’m building. Dealing with SPI/I2C and sensors/adc’s in Forth really is fantastic. The results in much more succinct hardware code IMHO than C or even higher level languages. Really Chuck Moore seems spot on when dealing with specific hardware.

One example is a simple Forth word (macro) to convert 3 bytes into one 32 bit number integrates well into code for dealing with an adc chip.

However I wouldn’t want to write while applications in Forth as dealing with stack swaps becomes annoying. Still writing your own Forth is pretty fun too. I did mine by basing C compiler XMacros which made porting to an Itsy M4 trivial (about 3-4 of work) [1].

Still there’s a few Forth’s for Arduino’s, Itsy’s, ESP’s [2] which are really fun as they enable repl style interactive programming with hardware while still being blindingly fast!

1: https://github.com/elcritch/forthwith 2: https://github.com/zeroflag/punyforth

Re: Levels of code in Forth programming (2002)

#6
post #4

Forth is pretty amazing. It really delivers on that old promise of “a language that will make you a better programmer in other languages”. However, from my experience, since there is basically no syntax, all Forth programs tend to be a DSL for the problem at hand. It’s almost like having to learn a new language ok each new project. It’s like a complete opposite of what makes Go great.

That is exactly what Chuck Moore wanted when inventing Forth.

Re: Levels of code in Forth programming (2002)

#7
post #4

Forth is pretty amazing. It really delivers on that old promise of “a language that will make you a better programmer in other languages”. However, from my experience, since there is basically no syntax, all Forth programs tend to be a DSL for the problem at hand. It’s almost like having to learn a new language ok each new project. It’s like a complete opposite of what makes Go great.

That is exactly what Chuck Moore wanted when inventing Forth.

I know. It’s a feature, but it makes it harder to share code (and Chuck Moore believes that sharing code is rarely worth it). Maybe he is right. His productivity is unbelievable :)

Re: Levels of code in Forth programming (2002)

#8
> Portability is not possible. Real applications are closely coupled to hardware. Change the platform and all the code changes

Some lessons simply did not age well.... Even in world of today's microcontrollers, which often have kilobytes of RAM and very different CPU styles, people still write mostly hardware abstracted code.

Re: Levels of code in Forth programming (2002)

#9
post #7

Earlier quoted context omitted.

That is exactly what Chuck Moore wanted when inventing Forth.

I know. It’s a feature, but it makes it harder to share code (and Chuck Moore believes that sharing code is rarely worth it). Maybe he is right. His productivity is unbelievable :)

The more time I spend dealing with blowback from excess complexity being imported in the form of 3rd-party libraries that offer complicated solutions to simple problems, the more I think that Chuck Moore was very, very right on that point.

Re: Levels of code in Forth programming (2002)

#10
This is a really interesting read, and as someone who’s almost exclusively programmed in high level languages, this approach seems alien to me.

A couple of questions:

1. Is it possible to write complex, modern applications (things like browsers, photo editors, etc. — things that would take millions of lines of Java or JS) using this style of programming?

2. What is “sourceless programming”? Where is a good place to learn more about it?

Post reply on HN