Hi Leslie,

Elephant does not pay any attention to type information defined as part of a slot metaobject. The lisp will complain during deserialization when you try to write the PIC to the changed slot, now of type STRING. Only OpenMCL, as far as I know, enforces type checking by default and asserts errors. Allegro and SBCL will quietly assign the wrong type to the slot, if I recall correctly. Lispworks will probably complain too.

The right user approach is to provide a function to walk over instances and update their representation or zero them out. Other than an assertion on deserialization or a general warning on type change, I can't think of a really useful default policy.

Have you tried this and seen what happens?  What Lisp are you using?

Ian

On Dec 20, 2007, at 10:38 PM, Robert L. Read wrote:

I haven't answered this because I've spent the last three days
trying to get Sean Ross's patch to work; the tests run green with it,
but if you run the tests again they fail.

The easiest way to answer this problem is to try it.

I may have to back out the changes that Sean sent in; they interact very
badly with the postmodern interface --- or at least the most recent
version of it.

I suspect that I may also be dealing with an SBCL bug of some kind in
the MOP.

I never set out to spend three days on this---the solution always seemed
to be right around the corner.



On Wed, 2007-12-19 at 10:50 +0100, Leslie P. Polzer wrote:
The user's guide talks about added and discarded slots, but what's the behaviour
when a slot changes?

Suppose I represent a picture with an object PIC that contains the location of a file holding it. I store a bunch of other objects that each have a picture:

(defpclass myobj ()
 ((picture :type PIC)))

Now I decide later on that a string would be enough

(defpclass myobj ()
 ((picture :type STRING)))

What will happen? A bad thing, i.e. a deserialization error?
Is there a way to define how a PIC should be converted to a STRING?

 Leslie


_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Reply via email to