[darcs-devel] darcs patch: Unsafe pull_firsts_middles optimisation (and 1 more)

David Roundy droundy at abridgegame.org
Mon Apr 25 07:35:23 PDT 2005


On Mon, Apr 25, 2005 at 02:12:44PM +0100, Ian Lynagh wrote:
> On Mon, Apr 25, 2005 at 08:44:28AM -0400, David Roundy wrote:
> > On Sat, Apr 23, 2005 at 01:26:12PM +0100, Ian Lynagh wrote:
> > > 
> > > I think this is OK now. The only troublesome cases were where isreversed
> > > was set. I think if we change job so the first component of the tuple is
> > > always the stuff we actually want then the code will be simpler and
> > > easier to understand.
> > 
> > The only problem there is that the code currently has a sort of
> > understanding that the "first thing to be applied" in a duple of patches is
> > on the right.
> 
> Hmm, OK.
> 
> > And I wish I had chosen it the other way around...
> 
> *nod*, I find it confusing that when commuting down a list the commute
> function takes the arguments in the opposite order to that of the list
> constructors.

A nice way of transitioning might be something like a

data OneThenAnother a = OneThenAnother { earlier, later :: a }

Only of course, I intentionally used very stupid names here rather than
using moderately stupid names that you might be tempted to actually use...

or perhaps something like

data OneThenAnother a = a :< a

where the :< could serve as a mnemonic to remember the the leftmost one
comes first.

Without some sort of clever transition plan, I'd be afraid to transition at
all to put leftmost first, since a partial transition would be worse than
no transition at all.

I've also thought about introducing something like "ordered lists" (not
meaning "sorted lists", but rather indicating which end of the list is
"first"), since PatchSet is actually stored (for good reason) in reverse
order from normal patch order.  But the trouble would be both in switching
all the code, and in dealing with the resulting lack of syntactic sugar.

> I was working on the theory that I am as likely to make a silly mistake
> as anyone else, so it would make sense to send patches here and then
> apply them a couple of days later if there was no comment.

Okay, that makes sense.  I was just afraid that you expected me in
particular to be reading them, and was feeling guilty that I wasn't...
You are sort of at the end of the line.  Tomasz can send patches in and see
if you apply them to darcs-unstable before he tries them on darcs-stable,
but you've got nowhere else to send things.
-- 
David Roundy




More information about the darcs-devel mailing list