|
Boost : |
Subject: Re: [boost] [process] Formal Review starts today, 27 October
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2016-10-30 11:33:27
> -----Original Message-----
> From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Bjorn Reese
> Sent: 30 October 2016 13:22
> To: boost_at_[hidden]
> Subject: Re: [boost] [process] Formal Review starts today, 27 October
>
> My first concern is about the use of tagged arguments, and especially
> the redirection operators, in constructors.
>
> Instead I propose that the library uses the Named Parameter idiom (see
> [1], not to be confused with what Niall labelled "tagged name parameter"
> idiom.)
>
> The bp::child object should not execute in the constructor, but rather
> via operator(). That way we can use the named parameter idiom to build
> up redirections and similar modifications. For example:
>
> auto compile = bp::child("c++").output(bp::null);
> compile("main.cpp"); // Executes
I like it too - a lot.
This method was used in a GSoC SVG plotting program where there were hundreds of potential options to set
my_plot.color("red"). line_width(3).x_size(100).y_size(200) ...
I felt it works very nicely, is easy to write, easy to read, and allows checks during compilation rather than when the string value
is read and acted-upon. It also allows later 'calls' to overwrite earlier calls, in the way common with command line arguments.
Paul
--- Paul A. Bristow Prizet Farmhouse Kendal UK LA8 8AB +44 (0) 1539 561830
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk