Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2003-05-28 17:34:24


> 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" )
> ;

I showed example out of context.

In fact my interface would look like this:
    cla::parser<...> p;
     p << ignore_mismatch
        << named_option( "version" )
                << place_to( show_version )
                << description( "...")
       << named_parameter<int>( "trace_level" )
                << default_value( 1 )
                << place_to( g_trace_level )
                << description( "...")
...

template<typename T>operator<<( cla::parser<...>, T& ) is the only interface
currently supported for both parameters and modifiers.

I may consider other propositions.

> But anyway, neither of these looks like a huge win over a function
> which simply takes 3 parameters. Probably the complexity isn't
> justified.

There maybe significantly more modifiers for parameter. For example:
optional, multiplicable, separator. Now you need to deal with 7 values.
Also I in fact believe that my version is simpler, cause only one interface
function required.

> Dave Abrahams

Gennadiy.


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