by jacquesm · 1y ago · 0 comments
I love esoteric languages. They're a never ending rabbit hole, and they really force you to revisit all of your assumptions about what it means to program. The most interesting ones for me were the Lambda calculus and Brainfuck.
And of course there is Forth. Which always felt like it was just around the corner from some kind of breakthrough but it never really happened.
Collaborative software projects and all of the modern tooling feel like massive (and endless) layers of abstraction on top of some pretty simple principles. Esoteric programming languages allow you to revisit programming without all of that super structure and for that alone they are valuable, they are pretty pure in that sense.
Forth, (I think even more so than lisp), is fragmented, because its philosophy is not that you write “a forth program”, but that you write “a forth” that does what you need it to do. Don’t like the sign MOD chose to compute ‘-3124 modulo -17’? Don’t add a new one, but change yours. Need better approximations for integer goniometric functions? Change them to work in half-degrees, etc.
That makes sharing code difficult and that, in turn, makes it hard to write large programs.
Nowadays, I guess a ‘solution’ to that problem would be to run zillions of forths as microservices in a single process, but I don’t think that’s practical (could be fun, though. In the limit, one could give each forth a VM page of RAM or maybe even less to work in. Imagine a forth whose sole goal is to maintain and edit a string, with words for string indexing, search, replace, duplication, etc. that runs together with millions of other forths in a single process.
"With 144 independent computers, it enables parallel or pipelined programming on an unprecedented scale. Map a data flow diagram or an analog block diagram onto its array of computers for continuous processes without interrupts or context switching."
The biggest issues that I had with Forth were: hard to work on code as a team, the 'screens', finding it increasingly hard to name words.
You must have had the luxury of zillions (that is: > 16 kilobytes) of RAM and ROM.
> The biggest issues that I had with Forth were: […] the ‘screens’
Most Forths on larger machines, where you had the luxury of not needing to tweak the base system to fit all your code in are fine working with source files.
Screens were an invention for smaller systems (for those who don’t know: early forth didn’t have a file system, but just a way to load 1 kilobyte blocks from disk. Code was written in such 1 kB blocks, called ‘screens’ because 1kB effectively filled a 16 line by 64 character terminal screen)
I can understand that perspective, there are plenty of purpose-built esolangs which are very close to the OG lambda calculus, and depending on your background the whole thing might seem bizarre and unfamiliar and ancient and irrelevant.
At least logically I see that could happen, but my heart disagrees. I see lambda calculus as a root of the conjoined tree[0] which supports all of modern programming. It feels to me like calling written English esoteric because some people get by without reading and writing!
(I'm certainyl not saying you're wrong, but just that it's fascinating how different two valid perspectives can be.)
If there is anything that helped me 'see the light' then it was this: that I could build anything with a core that small.
File under "old man yells at cloud."
It's available at https://howerj.github.io/subleq.htm if you want to try it online.
Forth is not that.
It was designed as a practical, stack-based language for embedded systems, instrumentation, and real-time applications. It emphasizes simpilcity, extensibility, and efficiency, and has been widely used in space missions, robotics, and hardware control. While its stack-oriented, postfix syntax can look unusual to those used to C-like languages, its purpose is entirely practical, not experimental or artistic.
> Here's the definition from the esoteric programming language wiki, which is a lovely resource for anyone interested https://esolangs.org/wiki/Esoteric_programming_language:
> "An esoteric programming language is a computer programming language designed to experiment with weird ideas, to be hard to program in, or as a joke, rather than for practical use."
It is most assuredly different than typical languages, but I don't think that means "esoteric". As an industry, we're sort of lost if "esoteric" means anything that doesn't look like Algol.
I'm of the opinion that one must write a forth to grok forth, and I'm far from alone in that. However, I'd not quite call forth itself esoteric. But to many, it's a language family... of which most of the members are esoteric inasmuch they only have a single user.
* shout-out to my friend whose forth supports lists, hash tables, and structs through syntactic sugar... https://github.com/cstrainge/sorth