name=value or -n value? (Visual Ambiguity)

idallen at watmath.UUCP idallen at watmath.UUCP
Fri Mar 23 15:59:57 AEST 1984


Here's one reason I prefer "name=value" over "-name value".

A command that looks like:

    bleen -name value1 value2

is syntactically ambiguous.  You have to "know" whether "-name" does or does
not take a following "value1" parameter.  This means you have to know the
semantic behaviour of the "-name" flag to know whether BLEEN is receiving
both VALUE1 and VALUE2.  It also means the potential for error is greater
with "-name value", since the "-name" might eat up one of the otherwise
independent arguments if someone thinks it doesn't take a following parameter.

This syntax ambiguity isn't present with the syntax form:

    bleen name=value1 value2

I need know nothing about any of the parameters to tell that BLEEN is
receiving only one unflagged parameter: VALUE2.  Since there is no
ambiguity, I can't accidentally create a semantically meaningful command
if I misunderstand the behaviour of "name=".  If "name" doesn't take a
parameter, then "name=value" would be flagged as an error.  If "name"
does take a parameter, and I try to use it without one, this would again
be flagged as an error.  With "-name value", the program can't tell.

I prefer the syntactic un-ambiguity.
-- 
        -IAN!  (Ian! D. Allen)      University of Waterloo



More information about the Comp.unix mailing list