I like how Lisp allowed me to use almost without any change the spec of Redis to define its commands in cl-redis library (https://github.com/vseloved/cl-redis/blob/master/commands.lisp). This gives, IMHO, the best possible decoupling from the implementation, which allows for easy refactoring of the underlying mechanisms (performed twice in the course of the library's existence) and seamless addition of new commands.

It's a good example of what Rainer Joswig called "putting parenthesis around the specification and making it run" (http://lispm.dyndns.org/mov/dsl-in-lisp.mov)

Best regards,
Vsevolod


On Wed, Jul 20, 2011 at 4:32 PM, Didier Verna <didier@lrde.epita.fr> wrote:

 Dear friends,

I'm starting to write a chapter for an upcoming book on domain specific
languages. The chapter is called (tentatively):

Extensible languages -- blurring the distinction between DSLs and GPLs

GPL meaning General Purpose Language in this context ;-)


My intention is to demonstrate how the task of implementing a DSL is
made easier when it boils down to an extension or subset of your
original GPL (hence reusing its infrastructure), instead of being a
totally different language, only written on top of the other.

Obviously, I'm going to illustrate this with Common Lisp, and I intend
to speak of dynamicity (not only dynamic typing, but in general all
things that can be deferred to the run-time), introspection,
intersession, structural or procedural reflexivity, meta-object
protocols (not sure about this one), macro systems and JIT-compilation.
Also, more specifically to Lisp, reader macros (compiler macros maybe?),
the condition system (and its ability to *not* unwind) and restarts.


Right now, I would like to know if any of you have DSL "pearls", nice
examples of DSLs that you have written in Lisp by using some of its
features in a clever or elegant way. I would also gladly accept any
point of view or comment on what's important to mention, in terms of
design principle or anything else, things that I may have missed in the
list above.


Thank you very much in advance!

--
Resistance is futile. You will be jazzimilated.

Scientific site:   http://www.lrde.epita.fr/~didier
Music (Jazz) site: http://www.didierverna.com

_______________________________________________
pro mailing list
pro@common-lisp.net
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/pro