[rucksack-devel] Rucksack's serializer: slot order problems?
Arthur Lemmens
alemmens at xs4all.nl
Thu May 22 09:57:33 UTC 2008
Hi Tayssir,
> When storing a CLOS object, Rucksack's serializer seems to assume that
> class-slots returns the slots in the same order each time. (This is
> from my reading of rucksack:load-slots.) If so, then where does the
> MOP guarantee this?
>
> My reading of the MOP is that class-slots gets its value from
> compute-slots, which returns the slots "in unspecified order."
Hmmm, very good point. I think you're right that the MOP doesn't guarantee
a fixed order of the slots. So storing normal CLOS objects (i.e. instances
of classes that don't have the PERSISTENT-CLASS metaclass) is not guaranteed
to work correctly. At the moment it seems to be no problem in practice, but
that's not good enough of course.
I'm not sure about the best way to fix this. Here are some options:
1. Try to guarantee a fixed order for the slots, e.g. by sorting the
list of slot names before saving or loading the slot values.
This is probably the cheapest solution (in terms of speed and storage),
and it should be easy to implement. But it can still fail after
redefinitions of non-persistent classes.
2. Try to store and load some kind of schema info, just like we do for
persistent classes.
A bit more difficult to implement, but we can probably use most of
the existing schema implementation, so it shouldn't be too difficult.
It should also be able to handle class redefinitions.
3. Whenever we save a slot value, also save the slot name. This is
simple and robust, but also seems very expensive.
At the moment I'm inclined to go for solution #2, but I'd be interested
in other opinions.
> Thanks for enlightenment,
Thank /you/ for enlightenment ;-)
Arthur
More information about the rucksack-devel
mailing list