Last Friday I spoke at the Utah Open Souce Conference on designing and building domain specific languages (DSLs). The slide from my talk are online (PDF). Our experience building KRL served as the catalyst and gave me concrete examples to talk about even though I'd hesitate to call it a DSL anymore.
Yesteday, I had an experience which reinforced my enthusiasm for building languages. Writing the post on building event intermediaries, thinking through the patterns, and talking to some of the Kynetx engineers who have the most experience with raising explicit events led to thoughts about how to generalize the
raise statement and make it even more powerful.
The problem had three parts
- event names were denoted by a constant (name),
- target rulesets were denoted by a constant (RID), and
- only one target ruleset was allowed
The obvious answer was to generalize the statement so that both event names and target rulesets were denoted by expressions. The value of the expression would be used to determine the event name or the target ruleset ID. Further, if the expression evaluated to an array, the members of the array could denote multiple target rulesets.
I sat down yesterday afternoon and in about 2 hours had made the changes and written the tests to confirm the changes worked. The code will be released today. I expect this simple change will provide a significant increase in the expressive power of KRL. Having the target of an explicit event be computed rather than static means that KRL is a much more flexible vehicle for writing event intermediaries.
My point is simple: a language designer has tremendous leverage. Small changes taking a few hours in the language's design and implementation can provide hundreds or even thousands of people a much more powerful tool that they, in turn, will use to accomplish mind-boggling feats. There are few other activities in programming with that kind of reach. More programmers should build languages. Even little languages can be the source of great productivity and satisfaction.