[darcs-devel] darcs patch: Cache pristine directory within NoPristine.

Juliusz Chroboczek Juliusz.Chroboczek at pps.jussieu.fr
Thu Apr 28 05:31:49 PDT 2005


> Because IORefs are scary beasts, and things that can disappear or change
> after they think you have finished using them scarier still.

No, once it is created the underlying pristine tree will never change.
The main point is that it is created lazily; the other thing is that
it is invalidated -- the directory still exists, but we mark the
Pristine data structure as invalid so that the next call to
surely_slurp_Pristine will create a new directory.

The first point could be solved by using a lazy field for the pristine
directory and some creative use of unsafePerformIO and
unsafeInterleaveIO.  On the other hand, I don't see how to do the
second one without using an IORef.

> I'm nervous that commands lazily reading their pristine will find it
> has changed or vanished out from under them.

That won't happen.  A pristine directory we create will exist until
Darcs exits (see withDelayedDir).

> Can we not instead create a temporary pristine and pass around a
> PlainPristine "/path/to/temporary_pristine" which gets removed on
> exit?

How do I do invalidatePristine in that scheme?

> I'm still not sure why you are worrying about this, though: if you want
> to do stuff that needs a pristine then surely you should have a
> pristine?

What do you mean?  Is ``you'' above me (J.Ch.) or the user?

                                        Juliusz




More information about the darcs-devel mailing list