Subject: Re: [boost] Case study: Boost.Local versus Boost.Phoenix
From: Pierre Morcello (pmorcell-cppfrance_at_[hidden])
Date: 2011-02-04 15:12:53
AM, Hartmut Kaiser wrote:
> Just my 2c: I find the proposed macro syntax to be
> ugly, unreadable and very difficult to associate with
> the corresponding function definition.
Gregory Crosswhite wrote:
> I thought so at first, but it didn't take very long to get
> used to it.
I have written the first implementation of the boost local function a year and a half ago, and later send it to Lorenzo, since he began later to work on the subject too. (Please note that he redid everything completely differently than my first implementation. The current Boost.Local is 100% his work as far as I know).
Anyway, I made the first implementation with several different macro frontend, one of the simplest call being :
// USAGE :
int i = 0;
int j = 0;
// Seems easiest way to handle 'This'
TestBreakable3* This = this;
++j; // we manipulate a reference to j
// I can add another nested function.
// calling private member is working
// (I use defect 45, which has a DR status...)
if(i == 1) return;
assert(i == 1);
assert(j == 15);
Adding the function name, and making it a functor would have been pretty easy too.
As a consequence, concerning the current Boost.Local, adding another macro like
// do what you want here with i,j,k
seems very feasible from my point of view.
I wanted to wait later (eg the library review) to see if there were any ouside interest for this auto-macro (not only me), and if I could contribute to this element.
BTW I consider that writing a local struct is very easy to read, but with a macro like the one I describe, things are also very straight forwards. This can save time and lines if you use a lot of local functions.
Concerning the interest for 'macro for local function', one year and a half ago, a few boosters expressed interest towards it. Some other were not interested for the same reasons already expressed in this thread.
So there is no need to feel lonely, whatever your point of view is :-) !
PS : I wanted to thank Gregory Crosswhite for the very detailed examples concerning the differences between boost.local and boost.phoenix. It is very interesting.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk