I had a great time at Lang.NEXT last week! There were a ton of amazing presentations and a lot of interesting conversations in between and after. There was a nice ongoing debate between native and managed languages and it was interesting to see some of what was going on in these fields.
What really interested me though was on the talks about Domain Specific Languages (of course). There was a talk about DSLs in Haskell and a talk on Bloom which is an internal DSL in Ruby and also a talk about R which is a DSL for statisticians.
But the one that really blew me away was the talk on pervasive parallelism in Scala, which turned out to be almost completely about the power of DSLs.
Specifically it was this slide that really got my attention:
Which is a pick2 diagram for programming languages, positioning DSLs as the solution for the problem of Productivity and Performance.
What was most amazing about this talk is that this is really the first time I’ve seen someone stand up and present DSLs with authority. And by that I mean someone who is making claims that are backed up by data and high quality research. When I talk about DSLs it’s based on my experiences and my intuitions and my understandings but not really very convincing data. The guys in the PPL however, really have some awesome papers on DSLs. I definitely felt validated to see such positive results and I hope this grants me some authority as well. When someone seems dubious of the promises of DSLs I can point them to the PPL and they can read for themselves the benefits that can be had.
In this talk Kunle Olukotun very clearly says that DSLs raise your level of abstractions and grant you a high level of developer productivity. He also brings up the very important concept of restriction in DSLs as a virtue. This is one very important fact that is not usually understood by advocates of internal-DSLs. Restriction is a very important key component to an internal DSL and is actually a virtue. From restricting the types you can use to what you can do with those types to the semantics and syntax of the language itself. For example, in a highly parallel application restricting your ability to mutate shared state is necessary, and making this restriction explicit in the language itself is actually a virtue of the language and helps to channel a developer into the path of least resistance. In many other languages they attempt to give you more features and less restriction but the opposite should be true for DSLs.
He even goes on to explain how patterns in the middle of their architecture can be considered ops for parallelism and how they use this for multiple DSLs. They even find overlapping parts of their domains that can be abstracted and shared between each other. This is really thinking about DSLs correctly, this is truly applying these ideas in a good direction. The PPL is using Scala for their runtime and they also use Scala to make restricted internal DSLs but I think this can apply for any language. He mentions that Scala has some good constructs for parallelism but also has some good features for making restricted internal DSLs. I think they ended up having to hack the Scala compiler some, but I am not completely sure.
One problem remains however… It takes about this many PhD students and faculty to make a DSL.
I’m working on that. 🙂