
"David Abrahams" <dave@boost-consulting.com> wrote
"Andrei Alexandrescu (See Website For Email)" <SeeWebsiteForEmail@moderncppdesign.com> writes:
1. Start from the Boost implementation of the C++ preprocessor, and add sane features to it. Keep the old preprocessor features as deprecated.
That one's a possibility. I personally would not want to solve these problems in the preprocessor layer because I want better integration with the rest of the language than that approach can offer. Others may feel differently, of course.
A better integration is not necessarily a good thing -- it's too restrictive. Something like FOREACH, for example (let's pay a tribute to the subject of this discussion), would not be possible in a well-integrated system -- the piece of code it generates is not, by itself, a valid fragment of a C++ program. So a totally independent code generation layer does have its advantages (at least it's more flexible).
3. Start an effort to add ways of manipulating ASTs to the native language so as to eliminate the need for preprocessing.
That approach has promise. Bjarne has a project to standardize a C++ program representation and manipulation library -- it could be interesting to build a metaprogramming system around that.
Well, of course, ultimately it should bring us to something like this, so that we would not have to, for example, instantiate a function template, and take its sizeof() just in order to figure out if one class is derived from another. IMO, it applies to template metaprogramming even more then to PP. I am not too optimistic about this happenning in the near future, though. Regards, Arkadiy