[rucksack-devel] defclass

Arthur Lemmens alemmens at xs4all.nl
Tue Aug 26 16:14:43 UTC 2008


Helmut Enders wrote:

> I need a defclass definition *before* I can open a rucksack.
> What is the right way to do this.
>
> Now I do the defclass twice, at toplevel
>
> (defclass ... (metaclass persistant-class))
>
> and at runtime in a function
>
> (defun repeat-defclass-for-rucksack ()
>     (with-transaction
>         (defclass ..)
>
>
> which is not very nice, because I have the defclass code two times.

I'm not sure why you need the definition twice.  At the moment, my
usual approach is to wrap (WITH-RUCKSACK (..) (WITH-TRANSACTION (...) ..))
around the toplevel DEFCLASS form.  Then I don't think you need to repeat
the DEFCLASS form later on.

But I agree that needing to wrap WITH-RUCKSACK etcetera around the
DEFCLASS form isn't very pretty, and it makes it almost impossible
to reuse the same class definitions with different rucksacks.  So
I recently wrote some code to work around this restriction.  This code
isn't in the CVS repository yet, but I tested it already and I'll commit
it Real Soon Now.

Arthur




More information about the rucksack-devel mailing list