[Openmcl-devel] Is this a bug?
Ron Garret
ron at flownet.com
Wed Feb 8 09:49:18 PST 2017
On Feb 8, 2017, at 9:21 AM, Shannon Spires <svs at bearlanding.com> wrote:
> Ron Garret <ron at flownet.com> wrote:
>
>> Ah.
>>
>> Is there a standard method that unconditionally calls all of the initform methods on an instance? Or that simply restores the instance to its newly created state? I tried INITIALIZE-INSTANCE and REINITIALIZE-INSTANCE and neither one of those seemed to work.
>
> This is unorthodox and very MOP-py, but it seems to solve your problem (i.e. after defining this method, shared-initialize resets the instance to its initforms).
>
> (defmethod slot-boundp-using-class ((class (eql (find-class 'foo)))
> instance
> (slotd standard-effective-slot-definition))
> (declare (ignore class instance slotd))
> nil)
I ended up doing this:
(defmethod reset ((o standard-object))
(let ((class (class-of o)))
(finalize-inheritance class)
(loop for slot in (slot-names class)
do (slot-makunbound o slot)))
(initialize-instance o))
rg
More information about the Openmcl-devel
mailing list