Boost logo

Boost :

Subject: Re: [boost] [Preprocessor] Adding variadic macros support
From: Edward Diener (eldiener_at_[hidden])
Date: 2010-11-24 17:14:25


On 11/24/2010 4:29 PM, Jeffrey Lee Hellrung, Jr. wrote:
> On 11/24/2010 1:09 PM, Edward Diener wrote:
>> On 11/24/2010 2:31 PM, Jeffrey Lee Hellrung, Jr. wrote:
> [...]
>>>> Questions, comments, suggestions etc. are all welcome regarding my
>>>> library.
>>>
>>> I think macro composition and argument binding like that supported in
>>> Chaos/Order (forgive me, I'm not really sure what the difference is)
>>> would be great.
>>
>> Please be specific. Remember that the focus of my library was strictly
>> to be able to use variadic macros easily along with Boost PP. I was not
>> trying to do much more than that because I wanted to merely support what
>> already exists in Boost PP with the addition of using variadic macros
>> easily with it. I do not mind trying for more but I want to stay within
>> the confines of what can be done with variadic macros to work with the
>> current Boost PP.
>
> To be specific: If one proposes to add an additional preprocessor
> library to boost, or an extension of Boost.PP, I only think one should
> also consider adding macro composition and argument binding, such as
> that in Chaos/Order or Avalanche (the [2] reference below). I brought it
> up under the context of limitations of the current Boost.PP interface.
>

I am still not sure what you mean by "macro composition" and "argument
binding" in a preprocessor library. Boost PP has much support for macro
composition within the context of what it offers in the form of
repeatable constructs, data types, etc. but I have a feeling you mean
something else. As far as "argument binding", in terms of preprocessor
macros all arguments are initially in the form of tokens, so I am not
sure what you mean by the phrase.

My own focus in my library is strictly what can be done with variadic
macro data. I admit an attempt to do other things to integrate in with
Boost PP is daunting, since Paul Mensonides was quite honest in
admitting that to work further on Boost PP in the face of broken
preprocessor support from many compilers, especially VC++, is not
something he wanted to do. If Paul could not, or would not do it, I have
a feeling it would be quite a bit more imposing for anybody else, given
the state of preprocessors in C++ compilers. Please also realize that
Microsoft, in particular, is fully cognizant of the bugs in their
preprocessor but has adamantly refused to fix them time and time again,
no doubt valuing compatibility with user's code over adherence to the
C++ standard in this regard. But who can truly know their reasons.

>> Also if Chaos/Order can do these things you may want it might be a good
>> bet that they can not be done with the many of the compilers which Boost
>> supports.
>
> True. How many compilers support your variadic macro library? It sounds
> like you've worked around many of MSVC's shortcomings, so I'm assuming
> most modern compilers. Perhaps I should be browsing through the
> docs/code...

Please do.

My testing shows that compilers which support variadic macros will
support the functionality in my library. But support for variadic
macros, even when I can workaround some of VC++'s broken support for
variadic macros, hardly means the sort of preprocessor support needed
for what you may want.

>
>>> I remember another individual posting a link to a
>>> preprocessor library in the past on the developer's mailing list that
>>> did something similar [2].
>>>
>>> [1] http://sourceforge.net/projects/chaos-pp/
>>
>> On this site I see no files which can be accessed. Perhaps there is a
>> way to access these files via cvs but I do not see instructions for
>> doing so.
>
> Same question (and answer) is in one of the messages in [2] below.
>
>>> [2] http://lists.boost.org/Archives/boost/2010/01/160619.php

The only cvs address I see there is:

cvs -d:pserver:anonymous_at_[hidden]:/cvsroot/chaos-pp

and I have no idea what anonymous_at_[hidden] is supposed to be but I
will try simply:

cvs -d:pserver:anonymous_at_[hidden]:/cvsroot/chaos-pp

>>
>> I do not know who this is and surely, whoever it is, he needs to put his
>> work somewhere ( sandbox, vault ) where it can be found by others.
>
> Agreed; I had thought I had the code stashed away somewhere but I can't
> seem to find it.

Neither can I.

>
>> Thanks for your interest in my library.
>
> Boost.PP is already really awesome, but I welcome any facilities that
> make preprocessor metaprogramming a little easier.

I believe my library makes using variadic macros a bit easier and
integrating its usage with whatever already exists in Boost PP cleaner.
As I pointed out in my documentation, the various data types of Boost PP
offer in general a much richer preprocessor programming interface than
variadic data, but variadic macros offer a more user-friendly syntax
than any of the data types of Boost PP. So to me the solution is to use
the best of both worlds when doing preprocessor metaprogramming. This
often involves using variadic macros as an interface for the end-user
and then using the functionality in my library to convert that data, or
pieces of that data, into Boost PP data types for internal manipulation
and intergration with the rich set of Boost PP constructs.

It is possible I could have done more with the variadic data in finding
ways to convert it to and from Boost PP data constructs. I am willing to
listen to suggestions on this account and add some functionality on this
account if others find it useful.


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