Metaprogramming in Heron

I have posted a document explaining how Heron implements metaprogramming online at Heron is a C++ style imperative language, and the metaprogramming functionality leverages the type system more logically than C++ template metaprogramming does. I would be interested in hearing any comments, suggestions or criticisms of the design decisions. Thank you very much!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Compile-time ?

From your page:
Metaprogramming refers to the design of algorithms that are executed during compilation (compile-time) as opposed to during run-time.

I may be mistaken, but I don't believe this is a generally accepted definition for metaprogramming. In the context of C++ (and, possibly, Heron), it may be correct, but languages like Lisp can manipulate the program text at run-time.

The greek prefix 'meta' says it all: as metalanguage is the language that speaks of language, metaprogramming is programming that deals with programs as data. The specific metaprogramming operations being runtime or compile-time is a completely orthogonal issue.

The idea of Heron's metaprogramming seems interesting, though, and I'll look at it more soon.


This is referred to as, for obvious reasons, "compile-time metaprogramming".

Correction made, thank you!

Thank you for the comments.

I have updated the definition to: Metaprogramming is the act of writing programs that manipulate themselves.

I don't believe that programs which output programs is a constrained enough definition of a metaprogram. For instance: is a compiler a metaprogram? A compiler doesn't usually guarantee that it will generate a real program. Is it only a metaprogram when given valid input? Is any program which outputs a valid program a meta-program?


A compiler can be seen as a metaprogramming tool, I believe, although it seems to be more usual to refer as metaprogramming when the output is a program in source form.

You can check the Tunes Cliki page on the topic. It differentiates between metaprogramming and reflection (that's when the program manipulates itself).