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

Sean Ross rosssd at gmail.com
Wed Jan 9 15:15:13 UTC 2008


On Jan 8, 2008 7:33 PM, Alex Mizrahi <killerstorm at newmail.ru> wrote:
> 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?


sorry for the delay,

Looks good to me although I'm now of the opinion that
(recreate-instance class) and
(reconstitute-instance object) are better names as they fit in with
the current naming
and argument conventions of CLOS.

sean.



More information about the elephant-devel mailing list