[rucksack-devel] inherited slots

Cyrus Harmon ch-rucksack at bobobeach.com
Wed Nov 15 08:24:59 UTC 2006


On Nov 15, 2006, at 12:15 AM, Arthur Lemmens wrote:

> Cyrus Harmon wrote:
>
>> so when I set a class to have metaclass rucksack:persistent-class,
>> the direct slots are persistent, but not the indirect (or inherited,
>> whatever the proper term is) slots. Is this by design?
>
> No.  See e.g. test-index-1a.lisp for a counter-example.

Ok, so in that case inherited slots from other :metaclass persistent- 
class classes are persistent. At least at first glance, it seems like  
it would be nice to use rucksack to make persistent versions of  
existing classes. See below...

>> e.g. if I do this:
>>
>> (defclass person ()
>>    ((name :initform (elt *names* (random (length *names*)))
>>           :accessor name)
>>     (age :initform (random 100) :accessor age)))
>>
>> (defclass persistent-person (person)
>>    ()
>>    (:metaclass persistent-class))
>>
>> then persistent-person will not have persistent name and age slots,
>
> I haven't tested this, but I think it would be wise to add the
> (:METACLASS PERSISTENT-CLASS) option to the PERSON class too.

Sure, that would work, but I'm imagining the case where person comes  
from some other library, and I want to make a persistent version of  
it. As it stands now, I have to redefine the slots in persistent- 
person to make them persistent. Why not make all slots persistent  
instead of only the slots that are defined in a class whose metaclass  
is persistent-class?

I'm sure there are good reasons for the existing behavior, but my  
naive attempt to use rucksack started with attempting to make  
persistent versions of existing classes by subclassing them. Changing  
the existing classes themselves to be persistent seems a bit  
counterintuitive.

Thanks,

Cyrus




More information about the rucksack-devel mailing list