[rucksack-devel] How do you use rucksack?
Christophe Rhodes
csr21 at cantab.net
Tue Mar 13 15:50:32 UTC 2007
"Arthur Lemmens" <alemmens at xs4all.nl> writes:
> Hi Christophe,
>
>> I began to investigate building a simple application over the weekend,
>> along the lines of an addressbook, and I thought I'd give rucksack a
>> try for the persistent storage facility. However, I quickly ran up
>> against the problem of wanting to delete objects from indices.
>
> Yeah, that's becoming something of a FAQ. You may want to try out the
> brand new RUCKSACK-DELETE-OBJECT function, which removes an object from
> the root set (if necessary) and from all class and slot indexes in which
> it appears. I committed this function to the CVS repository today.
>
> I haven't tested this function yet, and I'd be interested to know if it
> works for you.
OK. I'll continue exploring.
>> Anything which is indexed is a root for the garbage collector, so it
>> would appear that I can't have both indexing over some property of a
>> class and also have instances of that class ever be reclaimed by the
>> garbage collector. Is that right?
>
> Yes, that's right. But you can remove an object from indexes; see the
> implementation of RUCKSACK-DELETE-OBJECT.
>
> If this doesn't answer your question, let me know.
Well, I think it does up to a point, in that it removes the immediate
roadblock I ran up against; I don't think that it explains how other
people are using rucksack's exported functionality -- presumably you
yourself haven't felt the need for delete-object, but maybe that's
because you don't worry about using internal symbols? I don't know,
that's kind of why I asked.
Given the acceptability of delete-object functionality, I wonder if
there's a case for separating the object initialization and object
indexing protocols slightly. Currently, I think that the
initialization of an instance of persistent-object performs a number
of steps involging adding the new object to the applicable indices.
If that's so, maybe this is the natural inverse to what is currently
called delete-object?
What I'm thinking about is if, having deleted an object from all the
applicable indices, it could be convenient to add it back again. If
so, maybe there should be a defined pair of functions, conceptually
add-object and delete-object, and that add-object should be called
from the initialize-instance :around method, but also callable by
users.
Cheers,
Christophe
More information about the rucksack-devel
mailing list