[pro] Initialization of shared slots

Pascal Costanza pc at p-cos.net
Sat Jan 8 14:47:09 UTC 2011


On 8 Jan 2011, at 11:22, Faré wrote:

>>> 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).

I meant the dynamic environment, not the lexical environment.

For example, ContextL provides a way to capture dynamic environments, but this requires using ContextL's binding constructs.


Pascal

-- 
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel
Software Languages Lab
Pleinlaan 2, B-1050 Brussel, Belgium










More information about the pro mailing list