[darcs-users] The future of darcs - glowing or gloomy

Thorkil Naur naur at post11.tele.dk
Sun Mar 8 18:56:29 UTC 2009


Hi Eric,

Thank you for taking the time to respond to this. Except for one item that I 
would like to expand a little (the "user intent" discussion below), I have 
nothing to add, really. Your response has certainly reduced some of my 
worries and may thus free some energy to actually do things, instead of just 
worry about them.

On Saturday 07 March 2009 20:40, Thorkil Naur wrote:
> ... here is Eric's initial response to 
> http://lists.osuosl.org/pipermail/darcs-users/2009-March/018181.html 
> (Message-Id: <200903072035.11602.naur at post11.tele.dk>)
> ...
> On Friday 06 March 2009 18:29, Eric Kow wrote:
> > ...
> > On Tue, Mar 03, 2009 at 11:06:47 +0100, Thorkil Naur wrote:
> > > ... The thing that eventually made me
> > > write the present letter is your response "a newbies confusion with
> > > repositories - darcs or git"
> > > (http://lists.osuosl.org/pipermail/darcs-users/2009-March/018024.html)
> > > with its statement "darcs will always preserve user intent" - sorry,
> > > but this is not true in any significant sense.
> > 
> > This was really an innocent remark.

In the late 70's, I worked as a system programmer on a DEC PDP-10 system with 
the TOPS-10 operating system. New releases of the operating system and other 
system programs were in source form that you then used to build (compile and 
link) new executables. (Closed source had not been invented at that time, 
apparently, at any rate, it wasn't practised in this case.) We had fiddled 
with the operating system and other system programs, so when a new release 
arrived, the great SOUP (SOftware Update Package) was used to perform the 
required 3-way merge. (DEC acronyms were usually interesting, the debugger 
was DDT, of course, which stood for Dynamic Debugging Technique.)

I recall thinking at that time, this 3-way merge that SOUP was doing, surely 
conflicts could make such an operation impossible, but even if no conflicts 
were detected (say, no common lines were touched by the two, separate, edits 
performed on the same file), useless results could still be produced. All 
this is well known, of course, but ever since, I have rarely seen what I 
would call an honest description of what happens in such cases. Instead, ever 
more clever heuristics are invented, presumably hoping to reduce the amount 
of cases where innocent users are affected. My strategy would be more towards 
making users understand, in some detail, what goes on, warn them to take 
proper precautions and carry out suitable verification. And, clearly, if the 
idea is to educate the user, the complexity of my heuristics could be working 
against me.

> > I was just saying that darcs does 
> > not use heuristics to determine where hunks should be applied; it does
> > so with exact knowledge and hence, preserves user intent.

This is only true if the hunks faithfully represent the user's intent. Which, 
as I understand the word "intent", they fairly obviously don't, in most 
cases, and certainly, in general, cannot. Let me explain.

Say I add a line to a file:

> $ darcs whatsnew
> No changes!
> $ cat f1.txt
> Line 1
> Line 2
> $ echo Line 3 >>f1.txt
> $ darcs whatsnew
> hunk ./f1.txt 3
> +Line 3
> $

Now, the hunk surely represents the actual operation that I have carried out 
and, hence, darcs is able to carry out this operation to update another 
version of this file. But there is a difference between what the hunk records 
and my intent: When adding a line to a file, I rarely know anything about the 
number of the line that I am inserting, nevertheless the line number is part 
of the hunk that represents my change. And, vice versa, the change could very 
well be part of some grander intent that could be represented by other hunks 
or even be external to the darcs repository.

It is difficult to explain without some realistic example, but the point is, 
what my intent is could involve anything at all, including stuff from the 
real world that were even impossible to represent in any kind of hunk.

Let me continue the toy example. First we clean up a bit:

> $ darcs revert
> hunk ./f1.txt 3
> +Line 3
> Shall I revert this change? (1/1)  [ynWsfvpxdaqjk], or ? for help: y
> Do you really want to revert this change? y
> Finished reverting.
> $ darcs whatsnew
> No changes!
> $ cat f1.txt
> Line 1
> Line 2
> $

Then we exchange the lines of f1.txt:

> $ echo Line 2 >f1.txt
> $ echo Line 1 >>f1.txt
> $ cat f1.txt
> Line 2
> Line 1
> $ darcs whatsnew
> hunk ./f1.txt 1
> -Line 1
> hunk ./f1.txt 2
> +Line 1
> $

Here is a, perhaps, clearer example where the hunks that would be recorded do 
not match my intent: The hunks say, essentially, remove line 1, then add a 
new line (accidentally matching the removed line 1) as line 2. And I claim, 
this does not match my intent: My intent is to exchange line 1 and line 2. No 
removal of lines is involved. No new lines are involved. And also, the fact 
that the hunk is asymmetric, it does not mention the second line involved 
here, does not match the fact that a symmetric operation (an exchange) is 
involved.

We need to be careful and distinguish the mechanics of the editing that 
happens and the intent behind the editing. Even in carrying out the edit that 
exchanged the two lines, I actually rewrote the entire file, as you have 
probably noticed. But again, the mechanics are separate from the intent: The 
intent is something that sits in my head, so to speak, and cannot, generally, 
be represented as any kind of hunk.

In choosing the hunk to represent some change, surely heuristics are involved. 
In the exchanged lines example, darcs has chosen to remove and reinsert the 
first line, but the change could equally well be represented by the removal 
and reinsertion of the second line. And clearly, this different 
representation would potentially conflict in a different manner with other 
changes to the file and thus affect the user.

The fact that heuristics are not used to combine the mechanics of two separate 
changes is important, but heuristics are still used when producing the actual 
hunks. So I guess my view can be summarized by saying (1) When considering 
the total operation of performing a change, heuristics certainly play a role 
and what the heuristics are affect the user; and (2) Hunks cannot, in 
general, represent the intent behind some change.

Hopefully, this clarifies my original reaction to your statement that "darcs 
will always preserve user intent".

> > ...

Thanks and best regards
Thorkil


More information about the darcs-users mailing list