Live data from Hacker News

What the hell is Forth? (2019)

blog.information-superhighway.net

81–90 of 138 posts

Re: What the hell is Forth? (2019)

#82
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…

If a Forthlike language was to be made today, what features would it require to not be a hard-to-read mess? I can see some type of typesystem being useful, I dont know what else can make it better.

Re: What the hell is Forth? (2019)

#84
post #5

Earlier quoted context omitted.

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…

I don’t really feel I can judge whether it’s good or not to use generally, but it’s difficult to obtain a similar degree of DSL-ness even on pretty powerful (e.g. Micropython-grade) constrained platforms. Forth, along with Lisp, is one of the original DSL substrates ( Thinking Forth spends like half its pages on preaching EDSLs), and I don’t think it’s really been supplanted in that niche by anything that doesn’t req…

DSL just a library that exports a lot of functions that work together any language that allows naming functions does that?

Re: What the hell is Forth? (2019)

#85

A great introduction is the book Starting Forth [0]. It has the most charming illustrations I've ever seen in a text book. [0] https://www.forth.com/starting-forth/

It is a grave error to introduce Forth without noting that it is universally recognized as the First Programming Religion.

Lately Lisp and Rust have begun to take on religious overtones, but Forth came first.

It is probably also a mistake to introduce it without mentioning that the first two (normally one-character) words defined are pronounced "builds" and "does".

Re: What the hell is Forth? (2019)

#87

I don't think the article mentions metacompilation, which is a further cute and mind-bending feature Forth is known for. Metacompilation re-uses the live, running interpreter/compiler to compile a new system image of itself, from source code.

I've made a few meta-compilers before, there's nothing quite like bringing up a system from scratch and getting it to compile itself. It's one of the (few) things Forth is good at.

Re: What the hell is Forth? (2019)

#88
post #77

I started using Forth because I wanted a Reverse Polish Notation calculator at the command line. It turned out to be very practical and extensible. For example, I created many words to perform unit conversion, such as temperature: : 2fahrenheit 9 * 5 / 32 + ; : 2celsius 32 - 5 * 9 / ; Furthermore, I can even pull in live currency conversion rates from Yahoo Finance to go between USD and CAD. Since my underlying Forth…

Reminds me a bit of dc: https://en.wikipedia.org/wiki/Dc_%28computer_program%29

People who are interested in low-level language implementation might wish to learn a little dc, because its ability to easily produce arbitrary binary output may come in handy when boostrapping.

Re: What the hell is Forth? (2019)

#89
Of all those what is forth articles I've read, this has been my favourite read. Forth is an interesting language, but as a web dev, I've never realised its potential to be a useable language. However, I recently got a RP Pico, and was looking for a language to control it. Browsing the available ones, I saw a demo of a forth and the way it was used kind of blew my mind as it kind of connected the understanding of the machine architecture with the language directly. It kind of felt like I was one with the machine even though I was just turning an led on and off. Since then, I haven't done anything with the board, but I want to get into simple EV making and I feel forth is the domain language for this kind of endeavour.
Post reply on HN