Hacker News new | past | comments | ask | show | jobs | submit login

Some guy once said that Forth's fragility is its strength. It forces you to think in very simple terms.

"Zen" is a good way of describing Forth. Charles Moore often says things that seem like zen riddles in themselves, like Operating Systems are obsolete, you don't need local variables, you don't need structures, and a whole host of other things. It's very difficult to know what he's talking about without context, or why he thinks what he says.

I've toyed around with his colorforth, and given up. I doubt I'm the only one. It has cool stuff like you being able to change the fonts on the fly. It has a keyboard consisting of 25 keys (because 25 keys should be enough for anyone, apparently), which don't map onto a Qwerty keyboard (maybe Dvorak?) and has different modes based on colour. So I'm like "how the living fuck am I supposed to use this thing"? It's like trying to figure out the controls of some alien spacecraft.

It clearly works perfectly for Charles. He's clearly on some whole different level than the rest of us.

Forth is really fun to play with; before going back to using something that is a bit more practical. It has macro-like facilities. I find them very difficult to reason about. Forth seems like Lisp in terms of power, but at the opposite end of the spectrum in terms of size. Lisp is a complete language. Forth gives you a boxful of atoms that you assemble yourself.

I wrote a barebones Forth. Little plug: https://gitlab.com/mcturra2000/cerbo/-/tree/master/forth/v3 I haven't touched it for a year or two, though.

It incorporates the notion of a token type. The idea is that you could write a recursive-descent compiler using it, although I hadn't pursued the idea much.

To give you an idea of the malleability of Forth: I got bored with creating variables one-by-one, so I defined a word called "vars:". Now I can create several variables at once, e.g.: vars: foo bar baz

Here's an implementation (that works in my forth): : VARS: begin parse-word dup while $create 0 , repeat drop ;

I simplified the implementation and made the idea more composable: : VARS: line( $create 0 , )line ;

Done right, Forth looks like haikus. I'm not at that level, though.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: