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

Andrew P. Black black at cse.ogi.edu
Thu Aug 16 21:46:18 UTC 2001


At 14:10 +0200 2001.08.16, Henrik Gedenryd wrote:
>Still, the present Environments scheme contains
>an ambiguity, because it also allows inherited names, and these are not
>late-bound. Ie. when you can write Thing directly it is early bound, but
>when you write Envt Thing a message is sent. I think this semantic
>inconsistency can lead to really annoying, unintuitive bugs in our code.
>Particularly for inherited names, less so for names in the home Environment.
>
>Indirection is preferrable as you indicate, but we should really be
>consistent. So let's make all global references indirect.

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.  This seems 
exactly parallel to "Envt Thing", which will do a dynamic lookup in 
Envt at execution time.  Or are you meaning that the "Envt Thing" is 
more indirect, because "Envt" is itself subject to dynamic lookup in, 
presumably, Smalltalk?  I don't see how to avoid that.

	Andrew




More information about the Squeak-dev mailing list