Live data from Hacker News

What the hell is Forth? (2019)

blog.information-superhighway.net

71–80 of 138 posts

Re: What the hell is Forth? (2019)

#71

I didn't really understand forth till I tried implementing eforth in c. https://github.com/tehologist/forthkit Managed to write a compiler/interpreter that could understand enough forth to implement the entire system. Less than 500 lines and only uses stdio.h and compiles using TCC https://bellard.org/tcc/ That was so much fun I built a second one in under 300 lines of javascript for experimenting with canvas api in…

I know it's a lot of fun writing Forths and that's how most people tend to experience Forth, but I like to urge people to actually build applications on Forth. Understanding Forth by writing applications is probably the best way to get a feel for Forth.

Re: What the hell is Forth? (2019)

#72

I didn't really understand forth till I tried implementing eforth in c. https://github.com/tehologist/forthkit Managed to write a compiler/interpreter that could understand enough forth to implement the entire system. Less than 500 lines and only uses stdio.h and compiles using TCC https://bellard.org/tcc/ That was so much fun I built a second one in under 300 lines of javascript for experimenting with canvas api in…

[deleted]

Re: What the hell is Forth? (2019)

#73
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 interpreter runs on Python[0], I get the full large integer and floating-point support that Python has.

[0] http://openbookproject.net/py4fun/forth/forth.html

Re: What the hell is Forth? (2019)

#74
In my career of building programming languages, two of them arr Forth-based (stack-based)[0][1] and one is a Lisp[2].

I sometimes can't grasped how my Forth-based languages work when processing larger code, but it could have been easily because I never invested thst much into learning Forth anyways, which is why my third one is a Lisp.

Still, Forth is a very simple and incredible language. It is simple to understand, but harder to process on larger code. It is incredibly easy to implement, and easily extendable. It is also very predictable with only a few exceptions, which makes it a favorite for first-time esolangers.

The only shortcomings from Forth's design is getting used to stack-based operators, but I feel like it's something that can be adapted over time.

[0]: https://github.com/HoangTuan110/Nooklang

[1]: https://github.com/HoangTuan110/mil

[2]: https://github.com/HoangTuan110/owu

Re: What the hell is Forth? (2019)

#76

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…

> It's like Lisp. Just knowing about them is extremely enlightening . . .

I agree. My introduction to Lisp was Seibold's Practical Common Lisp -- a very hot book back in the mid-to-late aughties, that I suspect introduced a lot of people to Lisp.

Forth feels like it's having a similar moment (by which I simply mean: a lot of people are talking about it in terms of enlightenment, not that it's going to replace JavaScript!). So I wonder. Think someone will write a Practical Forth?

Re: What the hell is Forth? (2019)

#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

Re: What the hell is Forth? (2019)

#80

Here are some great resources on Forth: http://www.call-with-current-continuation.org/articles/forth... https://git.sr.ht/~vdupras/duskos/tree/master/fs/doc/design/... https://www.youtube.com/watch?v=9TJuOwy4aGA Let me quote the first essay at length: > Writing "good" Forth code is very hard, or at least what I consider good Forth code, which may be different from what others consider good. Forth has been called a "w…

I would not hold my breath for it to revive software engineering, if the end result is purportedly to make a pretty program. No doubt quality is severely lacking in modern programming, but programming is a means to ends other than autoeroticism.

And Forth is nothing new as a low-level, bending-over-to-the-machine language [1], except that its users to have constant urges to decry everything else as bloat (first link), civilisation-threatening, training wheels (third link), and all those wonderful things. Just don't do anything [0], and hoorah, you can write nothing too.

[0] https://news.ycombinator.com/item?id=28771886 is a classic on that topic.

[1] Bemusingly this does not make it necessarily fast; some Forthen are too simple and too low-level for compilers to get much done, c.f. https://applied-langua.ge/posts/i-dont-want-to-go-to-chel-c.... for the video described in the third link.

Post reply on HN