[getopt-sig] Separation of mechanics from semantics
Greg Ward
gward@python.net
Fri, 15 Feb 2002 13:48:55 -0500
On 14 February 2002, Patrick Callahan said:
> More complex command line option models, such as the one used in tar
> introduce additional layers to the specification of the command line
> "language", one that cannot be expressed or processed so simply. They
> check more than if the token is in the language or not. It is at this
> level that checks for combinations of tokens or such requirements as
> "one of c, r, t, u or x must be supplied" is done. I don't think it
> could be cleanly integrated with the lower level scanning done by
> optik.
I don't think "tar" -- or "find" or "dd", for that matter -- are
examples of user interface design that we should be encouraging (or even
enabling) people to perpetrate. Some UIs are just plain bad, and if
Optik discourages people from making bad UIs, that's all the better.
However, I suspect you could pull of something like tar's clunky and
painful interface using callbacks. I'm sure Russ Cox will jump in and
say that an iterative model is cleaner for this sort of thing, and he's
absolutely right: callbacks are themselves clunky and painful. They're
an escape hatch for occasions where you just don't fit in Optik's box,
not something you should use in every program. (Optik's box happens to
feel fairly spacious and accomodating to me, so I use callbacks quite
rarely.)
Bottom line, if you want to create a botched UI like "tar", you're free
to do so -- but you'll have to implement your own argument parser. I
suspect Russ' model would make more sense in that context.
Greg
--
Greg Ward - just another /P(erl|ython)/ hacker gward@python.net
http://starship.python.net/~gward/
Time flies like an arrow; fruit flies like a banana.