|
Boost : |
Subject: Re: [boost] The C++ Post-Processor
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-10-18 07:49:21
On Sun, Oct 18, 2009 at 4:49 AM, Christian Schladetsch
<christian.schladetsch_at_[hidden]> wrote:
> Hello,
>
> This is a general post about C++.
>
> Why is it that the pre-processor (PP) is the source of so much disdain, and
> yet it is the first resource exploited to 'fix' problems with C++?
>
> Why has the PP received so little attention over the years, from its early
> use as M4?
>
> This is a message to the powers that be: the PP is a powerful tool. It
> provides a 'context-cutting' mechanism for creating and extending solutions.
> It is a true "meta-programming" system built right into C++. No other
> language I can think of has a PP. This is often viewed as being a good
> thing, but I wonder more and more as I get older that a good PP is in fact
> needed to span some otherwise very difficult boundaries.
>
> Other languages are "dynamic" inasmuch as they reflect classes and allow for
> runtime changes to types and instances. I think we all here agree that this
> ability is counter to building firm, safe and efficient software.
>
> But the PP is similar to that, allowing a degree of dynamicy not otherwise
> available. Specifically, by exposing concepts to the PP we can leverage
> reflection and synthesis while building on inheritance and conglomeration.
>
> I don't have a point as such; I just wanted to raise the idea of developing
> M4 and the PP past where it is. There is a lot of low-hanging fruit there.
> This is evidenced by the fact that a lot of other languages are or can be
> transliterated to C++. Rather than thinking of C++ as the output, we could
> be thinking of C++ as the input.
>
> Perhaps a way forward for C++ is a good PP and a standards-based
> implementation of C++ in C++ so it can embed itself.
>
> I've written a number of languages, and in each I've had to address the
> issue of pre-processing. The latest attempts have resulted in a system where
> it parses and executes via AST input to produce an output that is then
> parsed by the same system to produce an AST that is then walked to
> eventually produce machine code. I think this model is best, and would be
> delighted to see some similar movements in the PP/C++.
>
> We have Boost.Wave to start with... Why not give it real Expressions? Loops?
> Scopes? Classes? Templates? memory management? IO?
>
> Is there any interest in a Boost.C++ ?
Have you looked at the D language, it did away with the C/C++ style
pp, but buffed up the template capabilities to let it do just about
anything the C/C++ PP can.
Lisp/Scheme is also the perfect example of the language running
itself, no PP needed.
I wish C++ templates were like D templates...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk