
Casey McCann wrote:
Not to speak for Jacques, :-)
and then you followed that up with a post with which I fully agree. Jacques
but my impression is that while TH itself is typed--it's just more Haskell after all--it doesn't do much to prevent you from generating code that is not well-typed. Or even well-formed, for that matter; my initial attempts to learn how to use TH produced quite a few "that's impossible!" errors from GHC (I do not think that word means what it thinks it means).
There's also type-level metaprogramming, as in e.g. HList, which is almost completely untyped. I have some personal library code that implements a simple meta-type system and it's a huge, horrid, painful mess for something with an expressive power no better than System F.
In contrast, MetaOCaml seems to be some variety of a multi-stage system where metaprogramming blends smoothly into "regular" programming with a single, consistent type ensuring type safety at all points.
- C.