<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-01-07 18:25 GMT+01:00 Nicolas Cellier <span dir="ltr">&lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_quote"><span class="">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Nicolas Cellier</b> <span dir="ltr">&lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&gt;</span><br>Date: 2015-01-04 11:30 GMT+01:00<br>Subject: Re: [squeak-dev] A puzzle for the New Year<br></span><span class="">To: The general-purpose Squeak developers list &lt;<a href="mailto:squeak-dev@lists.squeakfoundation.org" target="_blank">squeak-dev@lists.squeakfoundation.org</a>&gt;<br><br><br></span><div><div class="h5"><div dir="ltr"><div><div>Ah, you mean like <a href="http://stackoverflow.com/questions/27386061/overriding-compile-method-in-squeak/27413079#27413079" target="_blank">http://stackoverflow.com/questions/27386061/overriding-compile-method-in-squeak/27413079#27413079</a><br><br></div>A picture is worth a few dozen of words indeed.<br><br></div>I&#39;m pretty sure I saw a browser showing the whole metaclass hierarchy in the past which also might be helpfull to better understand these corners, but I just don&#39;t remember where exactly (st-80 v2.3?).<br></div></div></div></div></div></blockquote><div><br><div>Oh I just see it now, still there in Squeak trunk after all these years!!!<br><br></div>Select
 a class, select the class side button, and operate the pop up menu 
&#39;show hierarchy&#39;. It&#39;s not as powerfull as a Hierarchybrowser, but is 
already someting.<br> <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 dir="ltr"><div class="gmail_quote"><div><div class="h5"><div dir="ltr"></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-02 12:01 GMT+01:00 Trygve Reenskaug <span dir="ltr">&lt;<a href="mailto:trygver@ifi.uio.no" target="_blank">trygver@ifi.uio.no</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  

    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hi,<br>
    I had to dive into  the deeper regions of Smalltalk when I was
    preparing BabyIDE for Monticello. I needed to specialize a class  <i>fileOut
    </i>method:<br>
    <blockquote><font size="-1">BB5aMoneyTransferContext&gt;&gt;fileOutOn:
        aFileStream moveSource: moveSource toFile: fileIndex
        initializing: aBool</font><br>
      <font size="-1">    super fileOutOn: aFileStream moveSource:
        moveSource toFile: fileIndex initializing: aBool.</font><br>
      <font size="-1">    &lt;my own additions&gt;</font><br>
    </blockquote>
    This works, but the <i>fileOutOn:moveSource:toFile:initializing:</i>-method
    is defined in class <i>Class</i> which is not a superclass of <i>BB5aMoneyTransferContext</i>.
    So <i>super </i>does not refer to the superclass! What&#39;s going on?<br>
    --------------------------------------------------<br>
    There are two essential object structures in Smalltalk: The
    instantiation tree and the class inheritance tree. They are
    independent but intertwined as described in chapter 16 of the Blue
    Book. It&#39;s pretty complicated in the general but fairly obvious in
    this concrete example.<br>
    <br>
    Smalltalk is all about objects, not classes.  I used my <i>Smalltalk
      Reverse Engineering (SRE)</i> tool and produced the attached
    object diagram. The notation in the diagram is <br>
    <ul>
      <li>a rectangle represents an object </li>
      <li>the object&#39;s name is [&lt;oop&gt;] : &lt;class name&gt;</li>
      <li>a line represents a link. An &#39;instanceOf&#39; relationship is
        marked <i>/self class</i>; an inheritance relationship is
        marked <i>superclass</i>. </li>
    </ul>
    The diagram shows that the answer to the puzzle is one &#39;instaceOf&#39;
    relationship followed by four  &#39;superclass&#39; relationships. The
    departure from the usual is that while most class objects are
    instances of their own  Metaclass. ProtoObject is an exception. It
    has no superclass, but its metaclass has. It is class Class. Add to
    this that when an object receives a message, it goes to its class to
    find the corresponding method. [1224]:MoneyTransferContext  receives
    the super fileout message. The VM goes to  the superclass of its
    class, [3253]:Metaclass and looks for the required method in its
    methodDict. It doesn&#39;t find it and continues up the superclass chain
    until it finds it in [1254]:Class class . Straight forward, isn&#39;t
    it.<br>
     <br>
    I hope you enjoy this dive into the innards of Smalltalk and wish
    you all A Happy New Year!<span><font color="#888888"><br>
    --Trygve<br>
  </font></span></div>

<br><br>
<br></blockquote></div><br></div>
</div></div></div></div></div><br></div>
</blockquote></div><br></div></div>