Live data from Hacker News

Forth: The programming language that writes itself: The Web Page

ratfactor.com

31–40 of 89 posts

Re: Forth: The programming language that writes itself: The Web Page

#32

anecdata (and warning some people might not like that domain brought here), there's a mini vm in bitcoin that a subset of forth https://en.bitcoin.it/wiki/Script I just learned that this week

By that rule the JVM is a 'subset of FORTH'.

yeah apologies, I can't edit my comment now or I would

Re: Forth: The programming language that writes itself: The Web Page

#33

As soon as I met Forth, I felt I had to hack my own ( https://github.com/ttsiodras/MiniForth/ ) - and did so over a single week, two years ago. I targeted the Blue Pill and the original Arduino, but developed via cross-compilers so that I could test my code in the host. I became so obsessed with the project that I was looking forward to tinkering with it after coming back from work every day; so it was hacked in 5 ev…

> I became so obsessed with the project that I was looking forward to tinkering with it after coming back from work every day; so it was hacked in 5 evenings and a weekend. It was that much fun, to build a Forth.

Yep. In my computer architecture class as a freshman, we were supposed to do a final project of our choosing for the LC-3 (a RISC instruction set with emulator). I had dabbled briefly in Forth (with the RedPower 2 Minecraft mod) and thought it'd be fun to implement one. It ate up essentially all of my free time that semester: There was one morning where I only realized I'd stayed up all night when the sun started to come up and I finally checked the clock.

I've never found a practical use for Forth in my "real" life, but building one from scratch was an experience almost best described in religious terms. It was a pure distillation of Fred Brooks's description of programming:

> The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures.

> Yet the program construct, unlike the poet's words, is real in the sense that in moves and works, producing visible outputs seperate from the construct itself. It prints results, draws pictures, produces sounds, moves arms. The magic of myth and legend has come true in our time. One types the correct incantation on the keyboard, and a display screen comes to life, showing things that never were nor could be.

Re: Forth: The programming language that writes itself: The Web Page

#34

Tangent: I remember reading this in its original presentation-prototype form, which is basically this article with much less text and more plotholes. The reason I'm mentioning it is because it's also a beauty of minimalism in terms of underlying website technology. [0] http://ratfactor.com/forth/forth_talk_2023.html [1] http://ratfactor.com/minslides/

Is there something about writing your own FORTH and writing your own simplified presentation software :-? https://www.mankier.com/1/techtalk-pse

Re: Forth: The programming language that writes itself: The Web Page

#35

Earlier quoted context omitted.

There is also Thinking Forth, which is a kind of sequel [0] https://www.dnd.utwente.nl/~tim/colorforth/Leo-Brodie/thinki...

https://thinking-forth.sourceforge.net/ <- A better source. The one you linked includes a number of typographical errors early on (OCR errors?) that were grating for me to try and read. None of the errors I noticed in your link were present in the copies I checked out here.

Thank you for the correction, sadly my post can't be edited any more

Re: Forth: The programming language that writes itself: The Web Page

#37
Forth was influential, but it is somewhere between obsolete and niche. It is much more difficult to program in than even raw C, let alone C++ and offers no advantage in speed on modern hardware where memory access is the by far the highest priority.

Re: Forth: The programming language that writes itself: The Web Page

#38
If you wonder: How does it write itself? Isn’t it just the ability to write functions?

In a way, yes, but it's a bit more than that. Many programming languages allow you to define functions or methods, but Forth takes this concept further by allowing you to define new "words" that can become part of the language itself. These words can be used just like built-in operations, and they can even change the way the language behaves.

Also, because Forth is an extensible language, you can create words that define new control structures or modify the language's syntax. This is a level of flexibility that's not commonly found in other languages. In this sense, Forth can be seen as a language that "writes itself" because it allows programmers to customize and extend the language in a very fundamental way.

The ability to extend Forth by defining new words is somewhat similar to the macro system in Lisp. Both provide a way to extend the language and customize it to suit your needs.

In Lisp, macros allow you to define new syntactic constructs in the language. They work by transforming your program at compile-time, essentially letting you create your own domain-specific language within Lisp. This is a powerful feature that makes Lisp highly flexible and adaptable.

Similarly, in Forth, you can define new words that become part of the language and can be used just like built-in words. This allows you to extend the language's syntax and functionality, making Forth highly extensible and customizable.

Post reply on HN