thisContext question

Avi Bryant avi at beta4.com
Sun Apr 28 19:03:43 UTC 2002


On Sun, 28 Apr 2002, C. Gable Watts wrote:

> No, actually it's not because slots in the context have been nilled
> out.  It's because all 'doIt' expressions that you execute in a
> Workspace are compiled as a temporary method of nil (UndefinedObject).
> The 'doIt' is compiled as a method of nil, executed, and then the
> method is deleted.
>
> That is why the sender is nil, because the object that sent the
> message 'run' WAS the nil object.

No, you're confusing sender and receiver.  The receiver is indeed nil, the
sender is shown as nil because it's been nilled out when the context
returned.

Something else to try:

Test class>>run
  ^ thisContext copy

evaluating "Test run sender" should give you the response you were looking
for (of course, Test run sender should be == thisContext, so I'm not sure
what the original point was).

Avi




More information about the Squeak-dev mailing list