[Modules] Name space semantics was: Re: Some of my thoughts
Andrew P. Black
black at cse.ogi.edu
Fri Aug 17 06:58:16 UTC 2001
At 18:17 -0700 2001.08.16, Andreas Raab wrote:
>
>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.
I certainly believe you that there is no message send done at
execution time to resolve Foo. My point was that the value that is
used as the target of the #new message in
> testGlobalAccess
> ^ Foo new
is the value of the global variable Foo at execution time, NOT its
value at compile time. This is (to me) the fundamental meaning of
"dynamic", not whether the VM "cheats" rather than really using
message send to get the value of Foo out of the Smalltalk
SystemDictionary.
I tried the obvious test; first compile testGlobalAccess with Foo
bound to 5. Then assign Foo := Array, and invoke the method. What
do you know, the result is an an empty Array, Then assign Foo :=
Set. Now I get an empty set.
What I did _not_ try to do is assign another kind of object (other
than a SystemDistcionary) to Smalltalk, having first ensured that
this object understood #at:, and that the mapping that #at: delivered
was the same as that in the Smalltalk SystemDictionary. I didn't try
this because I "knew" that all that I would get is a crashed VM.
Maybe we are talking past each other. When I read your original post
I really though that you were saying that "Foo new" caused Foo to be
resolved into a class object at compile time. If that's not what
you meant, then I think that we both are on the same page, so forgive
me for dwelling on this point.
Andrew
More information about the Squeak-dev
mailing list
|