[getopt-sig] Comparing option libraries

Matthias Urlichs smurf@noris.de
Tue, 26 Feb 2002 18:00:01 +0100


Hi,

Tony J Ibbs (Tibs):
> is a Bad Thing to do. In theory, I'm not sure that's wrong. However, in
> any situation where an "alias" has been defined for a command. this sort
> of thing can happen quite naturally. It's certainly been not uncommon on
> Unix, and I'm sure I remember similar things on VMS as well. Thus, for
> example, if the alias is::
> 
I see your point.

# alias rm rm -i
# rm -f foo
(typical Unix root-user shell usage)

However, IMHO it's a Bad Idea to configure programs by aliasing them;
one can cause really stupid errors that way.
Programs should be configured by way of a configuration file or similar.

> Also, if options are to be taken from several places (configuration
> file, command line, etc.), what is the advantage to Optick or whatever
> in *knowing* this? Surely the aim should be to pass down arguments in
> order (e.g., those from the configuration file first, then from the
> command line) without the "command line" module needing to know that any
> of the arguments are "special" in any way.

"In order" != "by priority".  It shouldn't matter whether the program
reads the command-line options or the prefs file first, as long as the
former overrides the latter.

In fact, specifying an alternate prefs file by way of an option would be
inconsistent otherwise, since the order of options shouldn't matter.

> Hoping this makes sense and isn't just a diversion, Tibs
> 
It does, though I would not want my options package to know about reading
configuration files. Configuration values may come from many sources
(environment variables, XML files, option=value files, the Registry and
related atrocities), ...). An option processing package might want to
afford some way to feed values into it which may have either lower or
higher priority than the options themselves -- I don't yet have an opinion
whether that really belongs into the option handler -- but it should not
afford One True Way To Store Options Somewhere.

-- 
Matthias Urlichs     |     noris network AG     |     http://smurf.noris.de/
-- 
The price of success in philosophy is triviality.
		-- C. Glymour.