Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-05-29 01:03:02


David Abrahams wrote:

>> parameter<std::string>( "output" )
>> << place_to( output_file_name )
>> << default_value( "/tmp/abc" )
>> << description( "output file name" )
>
> While I don't find the interface proposed by Vladimir to be offensive,
> when you get a pile of function arguments of the same type together a
> named parameter interface *can* be a help. I don't think I'd use
> operator<<, though. If it's really about readability I'd tend to
> sacrifice some non-intrusive extensibility for a cleaner syntax:
>
> parameter<std::string>( "output" )
> .place_to( output_file_name )
> .default_value( "/tmp/abc" )
> .description( "output file name" )
> ;
>
> But anyway, neither of these looks like a huge win over a function
> which simply takes 3 parameters. Probably the complexity isn't
> justified.

And one important point: there are only three unnamed parameters. There's a
bunch of other things that can be configured, and they all use *named*
interface:

   desc.add_options()
       ("output", "file", "output file name").default_value("/tmp/abc")
       ;

- Volodya


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