Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-18 04:12:32


Jonathan Graehl wrote:

> Actually, I was suggesting that a value for an option that doesn't
> accept one, would be a parse error. Otherwise you have possible
> confusion with user thinking it's a value<bool> and by saying foo=false,
> you mean the same thing as not specifying the "foo" switch.
>
> What's the use of an option with an OPTIONAL value? :) Wouldn't you
> just omit the option and use the default value if you didn't want to
> provide one? It should be possible to specify options, at command line
> or in config file, that have no value; their presence or absence (often,
> commented or uncommented in standard practice) would determine the value.

It's possible for the absense of option and presense of option with no
explicit value to mean different things.

For example:

   - no '--compression' means no compression
   - ' just '--compression' means default compression level
   - '--compression=4' means the specified compression level

But one has to try hard to achieve this behaviour. I though about removing
optional values at some time, but never got to this. What do the users
think? Does anybody need optional values?

> I mean, a config file could have:
>
> value_opt=23
> bool_switch_opt
> ...
>
> (not bool_switch_opt=something)

Yea, that's a possibility.

> It would be perfectly pleasing to me though, to allow bool_switch to
> have a true or false value in a config file, and not at the command
> line. However, that would violate the existing design, wouldn't it?

Right, that's why I'm not sure what to do. There's a related issue. It's no
possible to specify a list of things in config file. For example, you can't
write

   include=a,b,c,d

(or some other separator). You need:

   include=a
   ...
   include=d

- Volodya


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