Tuesday, April 1, 2008

DSLs == Metalinguistic Abstraction?

From what little I've read so far, I have yet to see the novelty of the recent DSL (Domain Specific Language) trend in the software industry. Ever since reading the section on Metalinguistic Abstraction in Structure and Interpretation of Computer Programs, I've always tried to view the code I write as an exercise in language creation:
It is no exaggeration to regard this as the most fundamental idea in programming: "The evaluator, which determines the meaning of expressions in a programming language, is just another program." To appreciate this point is to change our images of ourselves as programmers. We come to see ourselves as designers of languages, rather than only users of languages designed by others. In fact, we can regard almost any program as the evaluator for some language.
So the act of defining a set of methods, an API, or a framework is the act of defining a language in which to define a computational process. It seems to me this new fangled DSL idea is just a restatement of the concept of metalinguistic abstraction.

However, one aspect of DSLs appears to be concerned with the ability to use programming language features in ways that make a DSL look like something other than their host language. For example, via fancy operator overloading; the use of closures and function invocations that look like data; avoiding the use of optional, cluttering syntax like line-terminating semi-colons; etc. If creative use of syntax and host language features increases the expressiveness of a DSL, I'm all for it. But I feel this aspect of DSLs should be clearly separated from the idea of metalinguistic abstraction.

Update: Just saw that the Wikipedia entry for DSLs does in fact contain a reference to metalinguistic abstraction, so I feel validated on my above post, even if I'm behind the curve.