[darcs-users] explanation of PATTERN?

Stephen J. Turnbull stephen at xemacs.org
Wed Dec 13 02:44:50 UTC 2006


Ralph Dratman writes:

 > Again, the above is quite likely to mislead.

The problem is the word "PATTERN", I guess.  Maybe better words for
the cognoscenti would be "QUERY" or "SELECTOR".  Does either help you?
It might be better to call the option "--select" for that matter.  And
the --patch option might better be called "--match-name".

(I don't know if renaming options would be feasible at this late
date, but of course pedagogically one could think of them by those
names.  Renaming the formal arguments is easy, if considered useful.)

 > From a language-design point of view the above are, frankly, terrible
 > constructs.

I don't think it's a design problem, it's a nomenclature problem.

 > Where one would expect to see a quoted regex,

That's not really Darcs's problem; Darcs documentation carefully
labels regexes as (surprise!) REGEX, and "those other thingamabobs" as
PATTERN.  It also explicitly says in the doc you quoted that "patterns
are described below."  The documentation could be improved, but the
expectations you describe are nowhere near universal.

 > one sees instead a field-specifier (eg., author or exact) INSIDE
 > the quotes! A far better syntax would have been something like the
 > following:

Well, no. IIRC one point is that the query language could be extended
to allow examples like

--match "author Lao-Tzu and exact 'Tao Te Ching'"

This is just a difficult design problem when you consider that there
are at least three conditions on the sequence of patches to be
generated (to, from, exact) and several field specifiers.  There would
be a proliferation of command line options to support all the
combinations of match sequencing and field specifier.  If you add
Boolean combinators it would just be insane.

The compromise is quite reasonable: have the very powerful
'--match'-style selector with a structured argument, and provide a
selection of abbreviations for common selectors with the limited power
but dramatically simplified syntax of the '--patch'-style options.





More information about the darcs-users mailing list