I've been digging really hard into just lately out of curiosity and let me tell you, it is deeply weird. Way weirder than Lisp or Tcl. It uses raw pointers as integers and uses them for basic variables, but supports compile-time evaluation. You have to manage the stack manually, but good style means arranging things to read like prose.

My only complaint is that most big Forth projects seem to be proprietary because there's almost no good codebase online.

The book I'm reading has contempt for storing source code in variable-length, named files. Numbered discrete blocks of 1k keep one honest and upright. Also, the Forth system will swap these blocks in and out of memory as needed.

I love it because it smacks the exact boundary of the abstract and the visceral machine. It's equal parts beauty and wtf.

I consider its complete lack of guardrails to be a terrible flaw for actual use, though. Hold it wrong and it will silently drape you in monofilament before slicing you to ribbons. I'm barely smart enough for C here.

Follow

I guess an experienced Forthwright (a crime that the word was never used afaict) would say that you should structure your words so that mistakes are obvious. It's possible that this is true - there's a lot less to obscure the definition of operations.

Compare with C:
Int square(int n) { return n*n; }

The same in Forth:
: square dup * ;

Sign in to participate in the conversation
Cantos.social

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!