Lambda the Ultimate

inactiveTopic DSL Implementation in MetaOCaml, Template Haskell, and C++
started 1/8/2004; 3:23:21 AM - last post 1/9/2004; 5:17:11 AM
Ehud Lamm - DSL Implementation in MetaOCaml, Template Haskell, and C++  blueArrow
1/8/2004; 3:23:21 AM (reads: 7882, responses: 4)
DSL Implementation in MetaOCaml, Template Haskell, and C++
Krzysztof Czarnecki, John O’Donnell, Joerg Striegnitz, and Walid Taha.

A very readable and gentle introduction to the metaprogramming facilities in O'caml, Haskell and C++.

Given the authors it is not surprising that the paper is balanced. The facilities in the different languages are compared, but not judged.

Well worth your time if you are interested in DSL implementation, or metaprogramming in general.


Posted to DSL by Ehud Lamm on 1/8/04; 3:23:53 AM

Luke Gorrie - Re: DSL Implementation in MetaOCaml, Template Haskell, and C++  blueArrow
1/8/2004; 11:31:48 AM (reads: 410, responses: 1)
Really interesting paper!

(Deleted question about MetaML that I realised the answer to.)

They mentioned several other issues: availability of domain-specific optimizations in the host language, inability to create new syntactic sugar, comprehensible compilation error messages and runtime error debugging. The Lisp world has plenty to offer in these areas, so I would have enjoyed an extra section to describe and contrast Lisp.

I'm really baffled that these papers manage to avoid ever using the L-word, even while matter-of-factly using terms like "quasiquote" and gensym. Is Lisp taken for granted, or is it known that Lisp has nothing to offer statically-typed approaches, or... what?

Ehud Lamm - Re: DSL Implementation in MetaOCaml, Template Haskell, and C++  blueArrow
1/8/2004; 3:01:50 PM (reads: 385, responses: 0)
The Lisp namespace is implicitly imported and opened...

The paper on well-shaped macros in Scheme may be somewhat relevant to your question, whether Lisp has anything to offer regarding statically-typed approaches.

Luke Gorrie - Re: DSL Implementation in MetaOCaml, Template Haskell, and C++  blueArrow
1/8/2004; 4:46:18 PM (reads: 363, responses: 1)
Thanks for the reference.

Quite an amusing difference between theory and (common) practice with the well-shaped macros: the theoreticians begin by saying that syntax-rules is too powerful (can diverge and so on), but the first thing the practitioners seem to do is add a defmacro because they don't find syntax-rules powerful enough. (Or is this mostly force of habbit?)

So on one hand we have the old-style defmacro with lots of generality and danger, and on the other there're Scheme/MetaOCaml/... systems strategically trading generality for comforting properties. How about the C++ guys, which direction are they headed in?

Ehud Lamm - Re: DSL Implementation in MetaOCaml, Template Haskell, and C++  blueArrow
1/9/2004; 5:17:11 AM (reads: 302, responses: 0)
It seems that the C++ world enjoys the idea of template metaprogramming, and sees it as a cool hack. I don't think they would support metaprogramming in general, and wouldn't want mp features added to the language. However they are uite happy to make use of the metaprogramming facilities that found their way into the language by "accident".