[pro] Initialization of shared slots

Faré fahree at gmail.com
Sat Jan 8 10:22:34 UTC 2011


>> Daniel Weinreb wrote:
>> - however, nothing tells us that the resulting value is used immediately
>>  to initialize the slot (it could just be stored somewhere), and
>>  implementations seem to be free to do so right now, or later when the
>>  first instance is created.
>
> Pascal Costanza <pc at p-cos.net> wrote:
> - When a class is defined for the first time, the :initform for a shared slot needs to be evaluated immediately, and its result must be stored in some temporary memory location. (There is no notion of first-class dynamic environments in Common Lisp, so there is no other way of ensuring that the :initform can be evaluated in the correct dynamic environment.)
>
No. You may immediately capture the lexical environment in a closure
`(lambda () ,initform).




More information about the pro mailing list