[rucksack-devel] indexing issue?

Cyrus Harmon ch-rucksack at bobobeach.com
Thu Nov 30 19:44:57 UTC 2006


Ok, it's slowly starting to make sense to me. I feel like a C  
programmer approaching lisp and asking how to get the address of the  
result of (cons... :)


On Nov 30, 2006, at 11:21 AM, Arthur Lemmens wrote:

> Cyrus Harmon wrote:
>> I don't suppose there is any notion of a multi-slot index or a  
>> multi-slot
>> uniqueness constraint?
>
> Not at the moment, but I think it would be a useful addition to  
> Rucksack.
> So if you have a nice design for this...

not at the moment, but I'll file this away as something to think about.

>> I wonder how subclassing affects this...
>
> I don't think I documented this, and I must admit I can't tell you
> from the top of my head.  But have a look at the definition
> of RUCKSACK-MAYBE-INDEX-CHANGED-SLOT and the INCLUDE-SUPERCLASSES
> argument for RUCKSACK-SLOT-INDEX.

ok, I'll check it out when I get there...

>>> All class and slot indexes are automatically added to the root set.
>>> So if you create an instance of a class that has an indexed slot,
>>> that instance will automatically be reachable from the roots and it
>>> won't be removed by Rucksack's garbage collector.
>>
>> Hmm... Ok, this I still don't quite get. when I make-instance a
>> persistent object, I should then be able to map-rucksack-roots to get
>> this instance?
>
> No.  But if you MAKE-INSTANCE a persistent object that has a slot
> or a class index (or, to be more precise, if you MAKE-INSTANCE a
> persistent object that is added to a slot or class index), you can
> be sure that Rucksack's garbage collector won't remove that object
> behind your back.

or added with add-rucksack-root, I imagine.

> You're not supposed to use MAP-RUCKSACK-ROOTS to find such an object.
> But you indexed it, right?  So you can use the indexes to find it.

Oh? is using the index the only way to find it? Again, my SQL bias is  
showing through here, but I view indices as an optimization, rather  
than the canonical interface to the data. If I wanted to say, map- 
slots over a non-indexed slot, I assume that would still work, right?  
is map-rucksack-roots not a preferred way to find things? I notice  
that there is a rucksack-map-objects, which sounds reasonable, but  
that it is #+later'ed out. Can you shed some light on this?

>> On a related note, how do I go about explicitly deleting objects?
>
> Actually, that's the wrong question ;-)
>
> You don't explicitly delete an object, the garbage collector will
> delete it for you if it can't be reached from the root set.  Just
> like in normal Lisp...
>
> If you really want to, it shouldn't be too difficult to delete an
> object from all slot indexes where it occurs.  But you should probably
> ask yourself if you really need this before you do it.

Ok, but if you make-instance something with an index and it gets  
added to the index, surely there's a way to remove it from the index,  
no?

>> I notice that delete-rucksack-root is not exported. is this
>> intentional?
>
> Yes.  I don't expect that a normal Rucksack user would need this
> function.

Ok, looks like i need to be using the rucksack-roots less, or at  
least not directly.

Finally, one further question... what does rucksack do about cycles?  
Is there a way to break cycles or have rucksack do something else  
intelligent with them?Sorry if this is in the docs, but grepping for  
cycle isn't turning up anything useful. When I try to add an object  
that points to itself rucksack seems to spin forever.

Thanks again,

Cyrus




More information about the rucksack-devel mailing list