Eric Wilhelm <[EMAIL PROTECTED]> writes:
> Please see this essay
> http://scratchcomputing.com/svn/Getopt-Modern/trunk/data/notes/why_order_matters.txt
Nice piece of writing, but it contains several flaws. For example:
If your spouse tells you to get "tuna and halibut, but not any
other fish", you would probably get in trouble if you returned
from the store with no fish, and yet this is what programmers seem
to expect from the following command-line:
go_shop --fish tuna --fish halibut --no-fish
But the results should be the same as below:
go_shop --no-fish --fish tuna --fish halibut
However, the equivalent of
go_shop --fish tuna --fish halibut --no-fish
is the spouse telling "tuna and halibut, but no fish". Now, if my
spouse starts telling me things like that, I've got reasons to start
worrying about her mental health.
But the bottom line of your essay is that human logic is not computer
logic (which is true) and that programmers (and computer users) often
abide with computer logic instead of human logic.
When my wife tells me to get "tuna and halibut, but no fish", I'll ask
her "what do you mean". As for the command line options, using
go_shop --fish tuna --fish halibut --no-fish
should result in an error message like "ambiguous use of conflicting
options" or something. All other interpretations are, according to
human logic, wrong.
But then there's that nasty little fact that's called history: we've
done it according to computer logic for 50 years or so, and it is not
easy to break habits. I think for this reason the original GNU options
parser used a "+" prefix to indicate that this option was going to be
interpreted differently than ususal.
-- Johan