Special Purpose Languages
Greetings from the end of the world! Sorry things are late, I had writers ablockalypse.
Remote workshops
All the conferences I was supposed to go to are now canceled. On the plus side, this means a lot more time to write. On the minus side, it means that I'm not spending that time talking to potential new clients. Most of my revenue comes from formal methods/software modeling workshops for companies. If you work at a place that could use my services, why not get the ball rolling? I understand this is an economically tough time for a lot of places, but even getting the conversation starting now for a much later date workshop be really, really appreciated. And I'm available to do workshops remotely. You can read more about this here.
(Should I do a formal methods recap for new readers? Probably. You can watch an introduction here).
((Also, thanks to everyone who filled out the survey on public workshops. Planning some stuff now!))
Github acquires NPM
I don't actually have anything to say on this, but everybody else is talking about this and I kinda feel like I should join in. Is it really newsletter if I don't talk about the news? ¯\_(ツ)_/¯
Special Purpose Languages
A couple of my favorite languages, AutoHotKey and Frink, are not quite general-purpose. But at the same time, they're not quite DSLs either. I am trying to pin down what exactly is the difference between those two definitions and why these languages don't fit into either one. Here's what I've come up with:
A general purpose language is one that's Turing complete and designed to solve a wide variety of different problems. A domain specific language is one that is designed to solve one problem in one domain very well. Most often it is not Turing complete, or if it is, you have to "step outside" the language. To me the difference is whether or not you can do an arbitrary problem in the language. Something like make
is domain specific. You can't run a Web server in make
. At least if you can, it's extraordinarily difficult.
That suggests to me a new classification: a special purpose language, or SPL. A SPL can solve arbitrary problems but also is intentionally adapted to one specific problem. This is usually done by adding first-class affordances or special syntax for that specific problem. To take Frink as an example here, you can easily run a graphics rendering engine or a Web server in Frink. At the same time, Frink is intentionally designed for unit manipulation and scientific arithmetic. A lot of the syntax and core features are designed around this purpose.
- Values separated by whitespace is counted as multiplication.
10 half kilogram
is equivalent to10 * 1/2 * kilogram
. - Parentheses are used exclusively exclusively for grouping and function calls instead use brackets.
- The
->
operator automatically converts between two unit representations, or a unit representation and a function output. The:->
operator changes how the interpreter presents you results, so you can get all calculations done in grams instead of kilograms. ||| lets you give names to complex dimensions,=!=
lets you define entirely new units at runtime, and::-
gives you new prefixes. kilograms
itself is actually justkilo grams
, not a special unit.
In a GPL these would be things that are added by libraries, not part of the core language. This makes GPLs more flexible than SPLs. The trade-off is that SPLs can solve the problem much more effectively than a GPL can emulate the same problem. They can have all the language features work in unision to do this thing very well. And the downside is that while they can still do things outside of that one purpose, they can't do it as well as they would if they were instead a GPL. So far my best and worst experiences in programming have been with SPLs. I suspect some this is because when working in SPL, I haven't had to do things like package management or heavy testing. I imagine that using them for production systems would be a more negative experience.
Other SPLs include shells, vimL, awk, maybe matlab. I'm curious what different kinds of SPLs will look like for different kinds of domains. What would one designed to manipulate directed graphs look like? What about one for doing simulations? Technically Simula-I was this but it migrated to being a general purpose language with Simula-67. And we've had half a century of PLT improvements to go off now.
I think the full domain space of languages is mostly unexplored. We focus a lot on making better GPLs, but for the majority of the population SPLs will be better suited to solve their problems.
If you're reading this on the web, you can subscribe here. Updates are once a week. My main website is here.
My new book, Logic for Programmers, is now in early access! Get it here.