Live data from Hacker News

What the hell is Forth? (2019)

blog.information-superhighway.net

41–50 of 138 posts

Re: What the hell is Forth? (2019)

#42

Wait! Is core Forth smaller than core Scheme?

Scheme is deceptive. I think R5RS was all of 50 pages or so. But try implementing quasiquotes, closures, lexical scoping, tail call optimization. Not to mention the trickier things of call/cc, dynamic-wind, hygienic macros. There is a surprising amount of complexity involved. Even if you do go with the simplest of GCs, which is probably stop-and-copy.

Re: What the hell is Forth? (2019)

#43

> 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?

Lisps, can be, and sometimes are, implemented in a similar way. Trying to figure out the exact number of Lisp primitives required to write the rest of Lisp in Lisp is seemingly a hobby for some. A compiler for a functional language usually transforms the program into another functional language, an intermediate representation, one much more friendly to machine-implementation. (The classic model has four pointers to four lists and has simple operations for the items in those lists, and that's about it.)

It's a relatively small leap to writing the language in that subset, and implementing a small virtual machine for that subset, and then executing the language. Many toy Scheme implementations have been written in this way. But most major implementations, while often written in Lisp (or Scheme), generally do not do that. They use the full language and are not able to bootstrap like that. Though the 1980s Lisp machines kind of did do it that way. The garbage collector and parts of the OS and runtime were written in a Lisp-like assembly language.

Re: What the hell is Forth? (2019)

#44

The author complains about not having local variables, but most decent Forth environments have them. It is not difficult to have local variables in Forth, just use a library or compiler that provides them.

The language has, perhaps, a bit too much Chuck Moore: Don't reuse code, don't make code reusable, and don't try to anticipate anything. The knob is turned all the way over to the "simplicity of implementation" end of things, and all else be damned.

http://www.cs.uni.edu/~wallingf/blog/archives/monthly/2017-1...

Re: What the hell is Forth? (2019)

#46

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…

A million errr 40 odd (my back is dim etc) years ago the end of year stuff (open day etc) was fast approaching. Our science teacher asked a few chaps (all boys prep school - Devon, UK) to have a go at showing off this computing thing or something, oh and I have this Forth thing on tape and this: ZX Spectrum. We'd graduated from ZX80s and 81s. We had 20 brand new Speccies newly bought. The Promised Land beckoned.

We cobbled together text whizzing smoothly across the screen and changing colours within about 20 mins of loading the thing. Loading from tape took a good five minutes. Unlike the C64 and Vic20 the Speccy used consumer tape units.

I have absolutely no idea what you are on about with your big boy modern programming terms but I managed to convince quite a few parents that their sprogs were at the cutting edge or at least wasting time well, back in the day!

Re: What the hell is Forth? (2019)

#47
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?

Did you mean:

THIS TRUTH ANY TO?

Re: What the hell is Forth? (2019)

#49
post #25

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

I remember and learned a little forth because of that console you could get with PowerPC Macs back in the day. I think I remember there was a key combination to boot in that embedded forth interpreter. It was pretty cool

https://en.wikipedia.org/wiki/Open_Firmware

(Hence the key combination cmd-opt-O-F)

Re: What the hell is Forth? (2019)

#50
Loved the article. I played around a but with Forth in the mid 80’s and my experience was very similar to the authors, eg astonishment that one could have a language/computing environment that was simple enough to understand in its entirety yet trivially extensible. Forth also makes complexity ridiculously hard, so you end up breaking down complex problems into simpler ones.

I never tried to build my own Forth, though.

Post reply on HN