<div dir="ltr"><div dir="auto"><div>That makes a lot of sense. Maybe the meaning of the message is just that: to change the superclass of the receiver and nothing else. <div>In that case, maybe I can add something to the method comment, to avoid the confusion I had.</div></div><div><br></div><div></div><div>On the other hand, about the implementation possibilities (supposing we wanted to implement it so that it did change the metaclass hierarchy), the #superclass: message is currently implemented on Behavior and overridden in Class. As the metaclasses include behavior from Metaclass and Behavior but not from Class, then we could add this at the end of the method Class>>#superclass::</div><div><span style="font-family:monospace">self class superclass: self superclass class</span></div><div>and that makes my example work as I originally expected.</div><div>I find it interesting because encapsulation is preserved while using a single message (with two different methods).</div><div><br></div><div dir="auto"></div><div dir="auto">Thanks Martin for your prompt and clear response!</div><div>Cheers,</div><div>Facu</div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">El jue, 27 de nov de 2025, 18:15, Martin McClure <<a href="mailto:martin@hand2mouse.com" target="_blank">martin@hand2mouse.com</a>> escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Hi Facu,</p>
<p>I haven't looked at the code, but perhaps #superclass: is a
low-level method that just does that one change. </p>
<p>A higher-level facility might want to change the superclass in
both the class and the metaclass, but it can't do that in one
method because of encapsulation -- one method can't change the
superclass instance variable in two different objects. So what
message would it send to each of the class and the superclass? One
logical selector to choose for that would be #superclass:.</p>
<p>Regards,</p>
<p>-Martin</p>
<div>On 11/27/25 12:42 PM, Facundo Javier
Gelatti via Cuis-dev wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hi!<br>
<br>
</div>
I've noticed that the #superclass: message does not affect the
superclass of the (meta)class of the receiver. For example:<br>
<br>
<span style="font-family:monospace">Object subclass: #A
instanceVariableNames: '' classVariableNames: ''
poolDictionaries: ''.<br>
Object subclass: #B instanceVariableNames: ''
classVariableNames: '' poolDictionaries: ''.<br>
<br>
B superclass. " => Object "<br>
B class superclass. " => Object class "<br>
<br>
B superclass: A.<br>
<br>
B superclass. " => A "<br>
</span>
<div><span style="font-family:monospace">B class superclass. "
=> Object class (not A class)"</span></div>
<div><br>
</div>
<div>The Class>>#superclass: method has a comment that
says "Not to be used lightly!", so I'm not sure if this is in
fact the expected behavior (but at least I was surprised by
it).<br>
<br>
</div>
<div>Cheers!<br>
</div>
<div>Facu</div>
</div>
<br>
<fieldset></fieldset>
</blockquote>
</div>
</blockquote></div></div></div>
</div>