<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi Timothy,</p>
<p><br>
</p>
<p>Please ignore if I chose the wrong level of explanation, this is always hard for me. :-)</p>
<p><br>
</p>
<p>All code executed in an inspector is executed against the inspected object as a receiver. That means that you can do absolutely everything with the object (including its class' state) you could do from a method compiled on its class as well.</p>
<p><br>
</p>
<p>> <span>TemplateTitleWords := nil</span></p>
<p><span><br>
</span></p>
<p><span>This is of course valid syntax when executing the assignment against a class that contains a class variable (!= class instance variable!) named like this.</span></p>
<p><span><br>
</span></p>
<p><span>> </span><span style="font-size: 12pt;">WikitextTemplates TemplateTitleWords :=  nil.  does not (as expected)</span><span></p>
<div><br>
</div>
<div>This is no valid Smalltalk syntax (and has never been). Variables (except globals) can only be accessed when compiling against the defining class. This guarantees real encapsulation of an object's state, which is great to preserve modularity. If you want
 to access state from a foreign class, you have to define an accessor message by implementing an accessor method returning the state variable, because only messages can be used to communicate with foreign objects.</div>
<div><br>
</div>
<div>In your example, navigate to the class side of <span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">WikitextTemplates
 and write a method #templateTitleWords: that directly assigns the parameter to the <span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;">TemplateTitleWords
 variable.</span></span></div>
<div><span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><span style="font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; font-size: 16px;"><br>
</span></span></div>
<div>WikitextTemplates >> templateTitleWords: aCollection</div>
<div>    TemplateTitleWords := aCollection.</div>
<div><br>
</div>
<div>Be cautious not to expose too many implementation details of a class by defining accessors.</div>
<div><br>
</div>
<div>If you need a meta way to do this, have a look at #<span>classPool and its senders. :-)</span></div>
<div><span><br>
</span></div>
<div><span>Best,</span></div>
<div><span>Christoph</span></div>
</span>
<p></p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von gettimothy via Squeak-dev <squeak-dev@lists.squeakfoundation.org><br>
<b>Gesendet:</b> Samstag, 12. September 2020 16:18:02<br>
<b>An:</b> squeak-dev<br>
<b>Betreff:</b> [squeak-dev] Setting class instance variable nil...that's interesting</font>
<div> </div>
</div>
<div>
<div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;">
<div>Ignore if spam...<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>It is interesting that I can reset a class instance variable inside one of the methods of a class with a doit.<br>
</div>
<div>However, I cannot do it from a Workspace .<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>TemplateTitleWords := nil  from within the method area works (surprising, but very handy).<br>
</div>
<div>WikitextTemplates TemplateTitleWords :=  nil.  does not (as expected)<br>
</div>
<div><br>
</div>
<div>I expect the latter, I am surprised by the former.<br>
</div>
<div><br>
</div>
<div>Don't get me wrong, it is a handy feature , but if it is a bug, here is a heads up.<br>
</div>
<div><br>
</div>
<div>cheers,<br>
</div>
<div><br>
</div>
<div>tty</div>
</div>
<br>
</div>
</body>
</html>