Boost logo

Boost :

Subject: Re: [boost] The C++ Post-Processor
From: Jeffrey Bosboom (jbosboom_at_[hidden])
Date: 2009-10-19 15:32:14


When I think of a "post-processor", I think of something like the Java
annotation processing mechanism. In Java, you can annotate classes,
interfaces or methods with user-defined attributes (with names like
@Test or @Entity). javac then invokes annotation processors (Java
programs) that can process a read-only tree of declarations and read
their annotations. While annotation processors are not allowed to
modify the original source files, they are allowed to generate new files
that get passed to the compiler, potentially triggering further
annotation processing. While limited by only being able to generate new
files, this is essentially a type- and syntax-aware post-processor.

To be honest, I haven't seen it be used for very much outside of
persistence frameworks and service registration (e.g., @ServiceProvider
in NetBeans), but it seems very powerful. I'm not sure how it would be
implemented for C++ (a g++ plugin?), but it would seem to be less work
than a C++ interpreter and would allow more powerful/easier computation
at compile-time. Annotations could perhaps be implemented using the
C++0x attribute syntax.

--Jeffrey Bosboom


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk