Discover the best of the web!
Learn more about Digg by taking the tour.
DSL Metaprogramming: Five Kinds of Source Code
1729.com — Traditional programming requires the programmer to deal with one kind of source code written in one programming language. DSL-based metaprogramming requires the programmer to handle five different kinds of source code (written in at least three different languages).
- 265 diggs
- digg it
- faulkner, on 10/12/2007, -0/+5why don't you just use lisp?
- burke, on 10/12/2007, -3/+1I didn't understand the article, so I'll digg you because lisp is good.
- squelart, on 10/12/2007, -0/+2The article mentions that... Did you read it before commenting?
"In the open-source world there is no "standard" way to do DSL metaprogramming. "In-language" metaprogramming remains popular, for example using Lisp (the traditional language of choice), and now Ruby (which trades simplicity and robustness for the opportunity to use better syntactic sugar). But these languages unnecessarily constrain the design of your DSL to be part of the host language. The fact that doing DSL metaprogramming this way is popular suggests that it is still harder than it should be to invent your own language and write an interpreter or compiler for it."
- tjstankus, on 10/12/2007, -0/+2I disagree with the article's premise. You don't have to write a DSL to work with one. You can write client code for a framework or library that employs a DSL as part of its interface. If the DSL is well-designed it makes things much simpler, not more complicated. Take Rails for example. A lot of beginning-level programmers have done great things in Rails, largely because of its well-designed, intuitive DSL.
I dunno... this article sort of reeks of Java fan-boyism to me. - Urusai, on 10/12/2007, -0/+1...counting the minutes until programmers do up a BNF spec of a DSL and yacc it for every project. Tick, tick!
S := ACTION ITEM
ITEM := happen
ACTION := MODIFIER gonna
MODIFIER := not - HyperbolePolice, on 10/12/2007, -0/+1Obviously this kind of approach anticipates a significant amount of project code to be written in the DSL itself. Whenever the prefix meta- enters the picture, developers should realize the complexity level has been raised a notch. It's quite possible that incremental gains in ease-of-development that the DSL can grant your project, can easily be subtracted by the overhead of maintaining and designing all of the supporting framework.
In a similar project I've been involved with where I introduced DSL, there were many painful project management challenges that appeared. The DSL itself was not born mature, and improving it while significant code was being written IN it is a challenge. There is also a natural tendency for the development team to fork into people that use the DSL and those that write it, and that can be disastrous.
Taking this approach just once in a large project will illustrate precisely the value of the toolsets that have grown up around general purpose languages which have to be re-generated from scratch by YOU.
Digg is coming to a city (and computer) near you! Check out all the details on our