Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-06-10 16:26:53

"Vesa Karvonen" <vesa_karvonen_at_[hidden]> writes:

> David Abrahams:
>>I'm writing an appendix on the PP lib for the MPL book today. I think
>>that'll demonstrate that it's possible to provide a reasonable gentle
>>and high-level introduction without exposing too many ugly details.
> That would be great!
>>- Fundamental PP Abstractions
>> - Macros
>> - Non function
>> - Function macros
>> - Tokens
>> - Sequences of tokens not including un-parenthesized commas
> Data structures are an important topic and their representation isn't
> fundamentally PP *library* specific.
> You might want to present the information on the representation of
> data structures (and simple macros like a projection operator for
> tuples and some sequences operations) here when you discuss
> fundamental PP abstractions.

I am not even trying to cover the whole PP library in this appendix,
much less the topic of PP metaprogramming in general. I am only
covering the fundamental abstractions on which the PP operates in this
section, not the things we can build with those. The PP doesn't know
anything about data structures.

> I would also probably discuss how to implement primitives like IF and
> WHILE using preprocessor macros at this point.

No way! That's why this is an appendix.

> The purpose being to show that the preprocessor is capable of
> significant computation.

The high-level library operations do that very nicely, thank you.

> I would also emphasize that the purpose of explaining the techniques
> is not that people would roll their own versions, but simply to
> deepen their understanding of the preprocessor.

That's for *your* book ;-)

>>Well, if you really have a conforming C99 preprocessor, you could use
>>Paul M's Chaos, which I think is both easier to use and *way* more
>>efficient than the current Boost PP.
> From what I know, Chaos is essentially an extended Boost.PP (meaning
> that Chaos is essentially a combinator library), with a single
> recursion backend (enabled by stricter requirements on
> preproprecessor conformance), which makes it more
> orthogonal. However, Chaos still shares many problems with Boost.PP,
> the main issues being that code will be highly verbose and very
> intricate. The verbosity and intricacy probably do not matter that
> much when one only performs simple repetition using the canned
> library macros.

Yes, I know that Chaos is not as beautiful as Order ;-)

Paul didn't implement continuations or many of the other high-level
abstractions you have. On the other hand, it is efficient without
having to pass around recursion depths IIUC.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at