Racket is my language of choice for pretty much everything now. It's the Lisp I've been always dreaming of: simple at its core while having all the batteries included to work on complex tasks like web development, servers, or games.
It is often described as a "Language-oriented programming language" for its ability to create languages on the fly.
I happen to have another wonderful language in my toolbox, that I reserve for most of the "down to the metal" activities. I would describe that language as a "Compiler-oriented language". It's called Forth.
Forth was created in the 70s by Charles H. Moore, which makes it, in the minds of today's young and fashion-victim devs, a language for dinosaurs.
I've been recently asked to explain (thanks @ambrevar) why I would use this, instead of Racket. So, without further ado, let's dive into the old, dusty and undocumented world of Forth, the language of the dinosaurs. Maybe there's still a place for it in our crazy cyber world (stay if you want dino-cyborgs).
Some years ago I bought the third telephone of my life. It's an archaic looking "feature-phone" which I want to last as long as possible. I'm not planning to buy anything more.
But I don't want an expensive 500€ smartphone. I don't want an easily breakable touchscreen, and I'm convinced there's a way to refurbish all the cheap "feature-phones" to make something usable and fast without all the fuss of a multiple Gigabytes operating system on it. I'm not planning to watch Youtube videos on my phone, only send good old SMS, so the idea of buying a cheap feature phone, and see what I could do about it started to sprout in my mind.
I bought a cheap 10€ phone with a digit keyboard, and kept it in a drawer as an emergency tool for about two years. Then the emergency came in: the screen of my Firefox OS phone broke, and typing on it became an exhausting experience, to say the least. So I switched to the cheap feature phone, and although it has a decent hardware, the software stack is completely out of place. What can we do about it?
Maybe we can live in a world where phones are used to place calls and send messages? Maybe we can live in a world where landfills are not stuffed with computer systems thousand times more powerful than what made us go to the moon, but still considered "old" because they cannot run the latest version of Snapchat? I'd like to live in that world, so I started a journey of retro-engineering to discover if I could make this dumb phone my phone.
For a long time, my favorite language was Python. It's fairly well designed
and useful for any task, from web servers like Django to 3D software like
Blender; from neural networks like TensorFlow to cloud computing platforms
Python offers so many libraries and tools for a developer to play with that
you feel you can achieve anything, given the right tool.
What I really enjoyed above all was the community, and the feeling that
everyone was according to the same set of standards (it was of course not
always the case) and that you could somehow easily agree on what was
"Pythonic" and what was not (spoiler alert: in fact, you cannot).
Now that I shifted to using Lisp languages (especially Racket), I see my
past self as childish and primitive, but it has been a brease passing through
Python as a part of my road to becoming a better developer, and alas I may
never use Python again for personal projects, I have learned a lot and would
still recommend it for anyone wanting to achieve efficiently, quickly and
elegantly some IT project.
So what is so good in Racket, that it made me think I finally found the
language of my dreams?
Well, there's a lot of features that make Racket an awesome language to work
with: parameters, continuations, contracts, syntax-parse...
But the feature I want to write about today is by far the one I find really
transcendental: #lang (pronounce "hash-lang").
#lang allows writing your own languages. Let's dive into it!