[squeak-dev] Setting class instance variable nil...that's interesting
Eliot Miranda
eliot.miranda at gmail.com
Sat Sep 12 14:40:20 UTC 2020
Hi tty,
> On Sep 12, 2020, at 7:18 AM, gettimothy via Squeak-dev <squeak-dev at lists.squeakfoundation.org> wrote:
>
>
> Ignore if spam...
It’s not spam.
>
>
> It is interesting that I can reset a class instance variable inside one of the methods of a class with a doit.
> However, I cannot do it from a Workspace .
The creasing is that doits always happen in the context of a specific receiver and different contexts have different receivers. Trace Compiler class>>#evaluate: down and you’ll see where the receiver is supplied before the Compiler instance is created.
In a Workspace the receiver is nil.
In an Inspector the receiver is the object being inspected
In an explorer the receiver is the currently selected object (IIRC)
In a browser the receiver is the currently selected class (or nil if none selected, or the current method’s class in a method list browser)
And within a doit (naturally since a doit is simply an anonymous method) all the inst cars if the receiver are in scope. Since nil has no inst vars there are no inst vars in scope in a workspace.
>
>
> TemplateTitleWords := nil from within the method area works (surprising, but very handy).
> WikitextTemplates TemplateTitleWords := nil. does not (as expected)
>
> I expect the latter, I am surprised by the former.
>
> Don't get me wrong, it is a handy feature , but if it is a bug, here is a heads up.
>
> cheers,
>
> tty
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200912/7a8a31cb/attachment.html>
More information about the Squeak-dev
mailing list
|