[rucksack-devel] Re: Rucksack, ECLM

Arthur Lemmens alemmens at xs4all.nl
Thu May 18 08:15:25 UTC 2006


[Taking Luke out of CC.  He can read the archives if he wants to.]

Nikodemus wrote:

> (with-rucksack (s ...)
>  (let (x)
>
>    (with-transction ()
>      (setf x (make-instance 'my-persistent-thing)))
>
>    ;; Transaction is now over, and committed -- so if X live it is
>    ;; being retained without a connection to the roots.
>
>    (do-stuff-to-cause-a-gc-of-dead-x)
>
>    (with-transaction ()
>      (add-rucksack-root x s))))

Hmm.  This sounds like a "don't do that then" scenario to me.  I suppose
we *could* automatically create a new object ID for X in the second
transaction and commit it to disk, but I don't think that's a good idea.
Changing object IDs behind the scenes sounds like asking for big trouble.

Probably the best approach would be to have the GC automatically mark
the in-memory copy of X as dead.  Then we could signal an error (how
about NECROPHILIA-NOT-ALLOWED-HERE?) for code that tries to do something
with a dead object.

So yes, in a sense Rucksack still can't eliminate all dangling pointers.
I don't think there's much we can do about this specific case, except
document the kind of things that you shouldn't do.

> It seems to me that for persistent objects (once they are actually
> stored on disk!) the "real" definition of identity is the object
> on disk, and the objects in memory are just "echoes".

Yes, that's the basic philosophy.

> ...unless of course there are both persistent and non-persistent slots,
> in which case you really have two instances sharing the same shadowy
> body: for the persistent slots the definition of identity that matters
> is mediated by the Rucksack, but for non-persistent slots it is the
> plain old EQ -- which is a matter of luck depending on that cache.

Yes.  I'm not big on mixing persistent with non-persistent slots.  I'm
inclined to see non-persistent slots mostly as a way to cache some
computations based on the values of persistent slots.  But I would be
interested in seeing other useful scenarios for non-persistent slots.

Arthur




More information about the rucksack-devel mailing list