Great to be talking to myself again. A small proposal to get my metaprogramming/template thingy working.
I am not going C-style templates, neither am I going the Haskell way, rather, I guess I am going enhanced LaTeX, i.e., I am going to work on the syntactic level with a C-preprocessor like syntax.
I.e., the only thing I am adding is a #define primitive, but with a twist. A define macro defines one in a series of rewrite rules, define macros pattern match on the output of the tokenizer. Also, a #definition macro expands a defining construct in scope to its series of tokens. And I guess #if, a rule is defined, #ifndef, if no rule is defined, #else, yeah, what else, #undef, remove all rules, are also trivial extensions.
#define add_guard('[', v, '->') '[' v ': if' v '> 10'
#define fac('1') '1'
#define fac(n) '(' n '* (fac (' n '- 1)))'
Not too sure, it might be too verbose in its usage, but it is simple, and Turing complete anyway.
Yeah, sure of it. Convenient well-know syntax, easy semantics, and just as type-safe as the Haskell proposal since the result is type-checked anyway. (Ok, the last is almost true ;) )
The sun shines, the sky is blue, I didn't sleep, again?