* ·······@hotmail.com
> What's the best design for such a system where an object inherits not from
> another class, but from an _instance_ of a class?
I would use a slot named "inherits-from" and write a slot-unbound method
that looks up the value of any unbound slots in this object in the object
pointed to by that slot, instead. This affords a dynamic inheritance
mechanism.
If the inheritance is static, i.e., the value of any unspecified slots is
_copied_ into the object that inherits from the parent object, do the
copy before you do any other initialization.
#:Erik
--
I found no peace in solitude.
I found no chaos in catastrophe.
-- :wumpscut:
Erik Naggum wrote:
>
> If the inheritance is static, i.e., the value of any unspecified slots is
> _copied_ into the object that inherits from the parent object, do the
> copy before you do any other initialization.
I'm new to CLOS. Would you mind to explain what do you mean in the
sayings above, especially in "...do the copy before you do any other
initialization."
--
Vladimir Zolotych ······@eurocom.od.ua
Vladimir V. Zolotych wrote:
> Erik Naggum wrote:
>>
>> If the inheritance is static, i.e., the value of any unspecified slots
>> is _copied_ into the object that inherits from the parent object, do
>> the copy before you do any other initialization.
>
> I'm new to CLOS. Would you mind to explain what do you mean in the
> sayings above, especially in "...do the copy before you do any other
> initialization."
If you copy the "static-inherited" values before any other initialization,
then it is possible to overwrite them by using initialization-keyword args
in make-instance or when using a :initform in a subclass.
Regards,
Jochen