DSLs in Boo, and a look back
About 6 years ago, I started writing the DSLs in Boo book, it came out in 2010, and today I got an email saying that this is now officially out of print. It was never a hugely popular book, so I’m not really surprised, but it really got me thinking.
I got to build several DSLs for production during the time I was writing this book, but afterward, I pretty much pivoted hard to RavenDB, and didn’t do much with DSLs since. However, the knowledge acquired during the writing of this book has actually been quite helpful when writing RavenDB itself.
I’m not talking about the design aspects of writing a DSLs, or the business decisions that are involved with that, although that is certainly a factor. I’m talking about the actual technical details of working with a language, a parser, etc.
In fact, you won’t see that, probably, but RavenDB indexes and transformers are actually DSLs, and they use a lot of the techniques that I talk about in the book. We start with something that looks like a C# code, but what ends up running is actually something that is far different. The Linq provider, too, rely heavily on those same techniques. We show you one thing but actually do something quite different under the cover.
It is interesting to see how the actual design of RavenDB was influenced by what my own history and the choices I made in various places. If I wasn’t well versed with abusing a language, I would probably have to go with something like CouchDB’s views, for example.
Comments
This book was a great inspiration for me, I have been using Boo for a long time but only after reading DSLs in Boo I have realized the potential of Boo and its flexible compiler. I've created tens of DSLs since that time and when approaching a new task I frequently start with imagining a DSL for it first. However, I'm quite worried about the Boo project, it's not very active and interest in it seems to be diminishing. Which is quite strange because it's imho one of the most valuable .Net tools.
It would be really great if you had included some actual examples of what you were talking about. Maybe in future posts?
Josh, I gave the example of Linq indexes and DSLs. Others are the safety limits, to avoid production issues. The internal structure of RavenDB, etc.
I'm just starting a new DSL and pulled this book off my shelf last week to refresh my memory. Thanks for writing a great reference.
@Rafal, do you have any IT related blog or Twitter account where you share your thoughts? If so, can I receive it? :)
@Rafal, do you have any IT related blog or Twitter account where you share your thoughts? If so, can I receive it? :)
Great Book, thanks for that!. It helped me allot to get started implementing a DSL for a large project using Boo. And Boo itself it's a language that is decades ahead of mainstream languages like C#.
If you hard to start fresh tomorrow on a DSL engine for the CLR, would you base it on Boo or something else?
João, I would probably go with Boo to start with, because I really like the syntax. Alternatively, I might create my own syntax & parser, then plug this into a Roslyn AST and generate code that way.
I thoroughly enjoyed "DSLs in Boo"; it made me think about using code in an entirely different way than I had used it before. I'd be fascinated to know you thoughts on how you could use Roslyn to achieve the same sort of functionality achieved with Boo.
Howard, Basically, that depend on the kind of language you want. If you are willing to go to the bother of either C#'s like language, or build your own parser, that is quite easy. You need to build the actual Roslyn AST tree, then just compile it.
Comment preview