Boost logo

Boost :

Subject: Re: [boost] [local] Review
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-11-18 22:19:13

On 11/19/2011 6:44 AM, Lorenzo Caminiti wrote:
>> As boost is trying to not only push the boundaries of C++ it should also try
>> > to set examples of best C++ practice. I would not consider Macro calls to
>> > interface with a library not good practice.
> I understand. I disagree but I understand your point. I disagree
> because the use of macros in this context saves the user from writing
> verbose boiler-plate code.
> IMO, it is similar to Boost.ScopeExit: Instead of providing the
> SCOPE_EXIT macros we could have said that the user writes the code to
> bind the variables deducing their types and it programs the local
> class with the exit code in the desstructor all of that by hand.
> However, using macros saves the user to write all of that and as I
> user I personally appreciate that. It is true that there is a trade
> off between the readability cost of using macros and the benefit of
> not having to write boiler-plate code. I find that trade off
> acceptable for libraries like Boost.SopeExit or even ForEach and (of
> course ;) ) also for my library so I don't have to write the
> boiler-plate code for the binding and the casting to pass the local
> class as a template parameter.

I share Thomas' sentiment. But IMO, it's really not about using macros.
it's about the syntax. Boost.Foreach looks exactly like a for loop.
The proposed boost locals syntax is arcane. IMO, bottomline: it's
about the design of the DSEL regardless how it is implemented. And,
the syntax proposed is, well, utterly ugly. Anything more complex than
foreach, done using the PP will be a mess. An ugly syntax can be acceptable
IFF there is no other way to do it. In this case (locals), there are
better ways of doing the same thing.


Joel de Guzman

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