"Rozental, Gennadiy" <[EMAIL PROTECTED]> writes:

>>>>   desc.add_options()
>>>>        // first argument is options name
>>>>        // second argument is parameter name
>>>>        // third argument is description
>>>>        ("output", "file", "output file")
>>>>        ....
>>>>        ;
>>>>
>>>> This means that one comment line is added for first argument, and
>>>> then you can very conveniently specify option name.
>>> 
>>> Poor maintenance programmer looked on this code and spread hands
>>> puzzled: What is option name and what is parameter name???? Which
>>> one should I use to identify argument? Where the value assigned?
>>> What is default value?
>>
>>Sorry, but this kind of questions can be answered only in docs.
>
> Sorry. But this is not good enough for me.
>
> In my terms above would look like this:
>
>     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.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to