[pro] Initialization of shared slots
Martin Simmons
martin at lispworks.com
Thu Jan 6 12:56:57 UTC 2011
>>>>> On Thu, 06 Jan 2011 10:33:43 +0100, Svante Carl v Erichsen said:
>
> Am 06.01.2011 01:31, schrieb Scott L. Burson:
> > In section 7.1 it says: "The :initform for a shared
> > slot may be used when defining or redefining the class."
>
> I think that this is the most directly applying passage for this
> issue. I am not entirely sure about the exact intended meaning of
> "may be" and "used", but at first glance it seems to me that this
> means that both the "SBCL way" and the "ABCL way" do conform.
> Portable code thus should not rely on either behaviour; it seems that
> whether :initform forms of shared slots are evaluated during
> definition or during first instanciation is unspecified.
Your last sentence is definitely not true because the dictionary page for
defclass says that the shared slot initform is evaluated in "the dynamic
environment in which the defclass form was evaluated".
I think it should really start "The value of the :initform for a shared
slot..." The point here is that the value is remembered and is "used" when
needed.
It says "may be" because it is not used if the slot is already bound.
--
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/
More information about the pro
mailing list