monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Re: magic selectors


From: Nathaniel Smith
Subject: Re: [Monotone-devel] Re: magic selectors
Date: Tue, 27 Sep 2005 17:06:49 -0700
User-agent: Mutt/1.5.9i

On Wed, Sep 28, 2005 at 12:26:38AM +0200, Richard Levitte - VMS Whacker wrote:
>  - I'm not sure I can see how predecessor, successor and head can be
>    combined in a useful way, so we might require that only one of them
>    appears in a combined selector.

Sure they can.  "The immediate parent of the head of this branch" is
the plausible use case that comes to mind (diff -r h:foo/P: -r h:foo).
Since IIRC you're the one that thinks sets besides branches may have
really interesting heads, presumably "the immediate parent of the head
of this arbitrary set" is also an interesting use case -- something
like 'diff -r c:builds-on-osx=true/H:/P: -r c:builds-on-osx=true/H:',
I guess?

> njs> Another solution would be to actually make them "procedural", say
> njs> that they're evaluated from left to right.
> 
> I did agree with that before, so now I disagree with myself.  I think
> something like H:/b:foo would be quite meaningless, rendering a
> procedural model meaningless as well.  That is, unless you can give me
> a practical example to the contrary...

Hrm, meaning of H:/b:foo depends on what the "initial set" is (I guess
we can think of this as 'what does the null selector "" select?').
Since the basic operation is "reduce by intersecting with a smaller
set", the natural "initial set" is "all revisions in the db".  In this
case H:/b:foo has a natural meaning -- plain "H:" gives the same thing
as "automate leaves", as H:/b:foo means "all leaves that are in branch
foo".

Probably the more compelling case for sequential execution is
disambiguator selectors:

  1$ monotone log --last=1 -r h:foo
  <Error: there are two heads -- hit uparrow and try again:>
  2$ monotone log --last=1 -r h:foo/D:1
  <hmm... that looks interesting -- use uparrow and shell copy/paste
  to get:>
  3$ monotone diff -r h:foo/D:1/P: -r h:foo/D:1
  <Error: has two parents -- hit uparrow and try again:>
  4$ monotone diff -r h:foo/D:1/P:/D:1 -r h:foo/D:1

Well, you could also just add --diffs to the 'log' command here, but
that's not the point :-).  (Though I guess there's a general point
that 'log --last=1 --diffs' may already be a perfectly good solution
to the use case that has everyone wanting predecessor/successor
selection.)

The point is that if the expectation is that you can stick a /D: on
the end of an ambiguous selector to just pick one, then line 4 will
violate that unless we do sequential execution.  In fact, line 3 will
violate it too, because unless we do sequential execution, we have to
pick whether to allow D:/P: or P:/D:, and they're both useful (the
former is "that thing there's parent", and the latter is "of those
parents, that one there").

Plus in the background, there's the general fact that people seem to
really prefer thinking in procedural terms to declarative terms.
(Look at how little uptake functional languages manage to get, and how
strongly novice programmers resist using declarative techniques,
despite the power of these approaches...)

Hmm, I think I'm arguing myself into the sequential execution thing.
Am I arguing anyone else into it, or just speaking nonsense? :-)

-- Nathaniel

-- 
"But in Middle-earth, the distinct accusative case disappeared from
the speech of the Noldor (such things happen when you are busy
fighting Orcs, Balrogs, and Dragons)."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]