Searching for the meaning of "I"

Smalltalk has a workspace environment. By definition, "self" refers to the object within which the current method is executed. But how do I understand the "current method" when I type in code snippets inside a workspace window? There is no current object using any method, or I missed something. Anyone can help?

+5
source share
2 answers

You can debug executable code, and you will see that you end up executing a temporary method for the object. For example, in Pharo, the DoIts workspace creates a method for UndefinedObject (nil). So here self will refer to nil.

+8
source

: "self" , "" . , .

Smalltalks self nil.

+4

All Articles