An attractive way to implement domain specific languages (DSLs) is by writing a library in a host language. Some DSLs, however, do not fit perfectly within the host language and a pure library solu-tion is insufficient. In many cases, metaprogramming offers a solution to the problem. This paper surveys and compares the metaprogram-ming support offered by three languages—Template Haskell, C++, and
... [Show full abstract] MetaOCaml—and discusses the techniques they make available to the implementer of a DSL.