[pro] Initialization of shared slots

Svante Carl v. Erichsen Svante.v.Erichsen at web.de
Thu Jan 6 17:08:55 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

Am 06.01.2011 13:56, schrieb Martin Simmons:
> 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.

The same page also says that the :initform form is evaluated every
time it is used to initialize a slot.  The question is when this
initialization should take place for shared slots, not in which
lexical and dynamic environment (that is clearly specified).

After rereading section 4.3.6 about how redefinition of classes works,
I think that your interpretation of "may be" is correct.  I guess that
it would not make sense to specify that initforms of shared slots are
evaluated during redefinition but not definition of a class.  I wish
section 4.3.2 was as explicit as 4.3.6.

To summarize: I now think that :initform forms of shared slots are
specified to be evaluated during class definition.

Best wishes
Svante
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0l9ycACgkQFZBb0npmKsxb+wCeKohWP02nVnvx7KUepznlpHsc
jcQAn3xxMofPDDdSOEOWjYfHyataelys
=bTVj
-----END PGP SIGNATURE-----




More information about the pro mailing list