Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2008-08-13 11:50:06


on Wed Aug 13 2008, "Paul A Bristow" <pbristow-AT-hetp.u-net.com> wrote:

> This looks neat and feels C++-ish (rather than IBM JCL - but you're
> too young to remember that ;-)
>
> Jake Voytko and I concluded similarly when developing Scale Vector
> Graphics PLotting user interface where there are hundreds of possible
> functions (x_axis_color(red), point_color(green)...).
>
> (Watch this space for a enhanced and possibly useable version).
>
> Chaining calls is convenient because you don't need to remember the
> order. The compile time seemed a little better too compared to
> Boost.Parameter, and the setup more intuitive (C++y rather than
> macros).

You're free to use a "C++-y setup rather than macros" with
Boost.Parameter if you're willing to present your users with a slightly
less natural interface. The point of the macros is that

  1. they give your *clients* a natural interface, and

  2. they make your function body more natural to write (no need to use
     traits to access the types of the actual arguments nor any need to
     write fiddly function calls to get at the actual argument values

> Since it now clear that named parameters are not going to in the C++
> language proper, I believe that this is best idiom to use. Despite
> being unfamiliar, chaining is obvious once you get going with it.

And it has not-so-obvious downsides.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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