[elephant-devel] Re: recreate-instance-using-class

Alex Mizrahi killerstorm at newmail.ru
Tue Jan 8 19:33:53 UTC 2008


SR> I'm sorry to hear that my patch caused so many issues with postmodern
 SR> and I'm quite keen to investigate the cause of this. I'll be
 SR> installing setting up the postmodern backend and seeing if I can track
 SR> down the causes of these problems.

looks like it's related to some deep weirdness of db-postmodern
implementation, and i think i've almost tracked this down, so i don't
recommend anyone spending time on this. (well, until/if i'll give up..)

however i'd like to see comments about class "persistent" -- it doesn't even
recieve shared-initialize, are there any reasons for special threating of
it?

and are there reasons for using this recreate initialization sequence for
class "persistent"?

only instances of classes of persistent-metaclass metaclass (e.g.
persistent-object) can have persistent slots, so it makes sense to bypass
make-instance only for such classes.

so i'm thinking about patching this recreation stuff this way:

;;
;; RECREATING A PERSISTENT INSTANCE
;;

(defmethod recreate-instance-using-class ((class standard-class) &rest 
initargs &key &allow-other-keys)
  "recreate-instance-using-class uses normal initialization sequence for 
ordinary classes."
  (apply #'make-instance class initargs))

(defmethod recreate-instance-using-class ((class persistent-metaclass) &rest 
initargs &key &allow-other-keys)
  "objects having persistent metaclass bypass normal initialization sequence 
when they get deserialized.
   go figure how to do 'transient' initialization for them.."
  (let ((instance (allocate-instance class)))
    (apply #'recreate-instance instance initargs)
    instance))

(defgeneric recreate-instance (instance &rest initargs &key 
&allow-other-keys)
  (:method ((instance persistent-object) &rest args &key from-oid (sc 
*store-controller*))
   (initial-persistent-setup instance :from-oid from-oid :sc sc)
   (shared-initialize instance t :from-oid from-oid)))

what do you think of it? 






More information about the elephant-devel mailing list