Hacker News new | ask | show | jobs
by wryl 789 days ago
Howdy.

I'm Wryl, the original author of this language. I sketched it out in late 2018 and played with it in 2019 after seeing some Mill architecture articles floating around. I mostly created it out of spite, thinking "You don't need fancy designs to do high-level things on bare metal!"

At the time, I called it a term rewriting language, which seem a bit of a weaker label than what it is. It's more like a string rewriting system with variables and nested strings, with parentheses acting as the separators for sub-strings.

It got to the point where I could transcribe Quicksort from the Haskell wiki into a fragment of Modal. I stopped playing with it after I had some not-so-fun industry experiences, and declared my work a dead-end.

Devine from Hundred Rabbits managed to get me to talk about it a bit more, and has taken the language far beyond what I could dream of. It's now gone beyond a sketch to a genuine marvel of engineering which is continually being refined as we figure out more idioms. The language is in very good hands.

I'm of the opinion that rewriting is an unexplored paradigm, and that we don't really understand how to build software. Modal was a product of my research efforts, which are still on-going. I hope to bring more projects like this to light. This has been quite fun.

1 comments

Term rewriting is woefully overlooked, maybe because the paradigm is rather open-ended. Questions about fixed or variable arity, what rules to apply in what order, what kinds of pattern matching to support, can make the language very limited or intractably inefficient depending on the answer.

I like that Modal just rolls with Peano arithmetic rather than awkwardly bolting on numerics. It's impractical, but it doesn't have to be practical - this is an exploration of a concept

What's nice about rewriting as a concept is that bolt-on extensions to make things fast don't have to be awkward.

Built-in rules that take priority over user-defined ones, as well as special variables in Devine's implementation, allow us to gain back speed while retaining some idea of purity. We know these operations can be phrased in terms of rewrite rules, so let's shortcut them and use built-in arithmetic in place.

You'd never know the difference! There's also a lovely arithmetic library built by d6 that you may enjoy. It does arithmetic digit-by-digit, and they're continually improving it to run faster.

https://git.phial.org/d6/modal/raw/branch/d6/binary/arith.mo...