[Modules] Name space semantics was: Re: Some of my thoughts

Andreas Raab Andreas.Raab at gmx.de
Fri Aug 17 01:17:04 UTC 2001


Andrew,

> I thought that all global references already were indirect.  That is,
> if I write a method
>
> 	testGlobalAccess
> 		^ Foo new
>
> where Foo is a global variable, then the value of that global is
> retrieved when the method testGlobalAccess is executed, not when it
> is compiled.  In fact, the code that is generated is
>
> 9 <40> pushLit: Foo
> 10 <CC> send: new
> 11 <7C> returnTop
>
> So the usual form of global class references already does a dynamic
> lookup in the dictionary Smalltalk at execution time.

No. Unfortunately not. What you see in the above (pushLit: Foo) pushes the
value (e.g., second field) of an object in the CMs literal frame. If you
look at the literals of the above method then you'll see that one of those
literals is the Association #Foo -> Foo and pushLit: goes right into the
value field (e.g., doesn't even bother to send #value to this association).
So there's no message send involved at execution time.

Cheers,
  - Andreas





More information about the Squeak-dev mailing list