<div dir="ltr">Hi Tobias,<div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 21, 2015 at 10:24 AM, Tobias Pape <span dir="ltr">&lt;<a href="mailto:Das.Linux@gmx.de" target="_blank">Das.Linux@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Chris<br>
<span class=""><br>
On 21.01.2015, at 17:39, Chris Muller &lt;<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>&gt; wrote:<br>
<br>
&gt; Okay, I found the invalid super-pointer behavior.<br>
&gt;<br>
&gt; It&#39;s a lot better with Bert &amp; Tobias&#39; fix, but still there to a smaller degree..<br>
&gt;<br>
&gt; Object compile: &#39;test  ^&#39;&#39;Hello from Object&#39;&#39;&#39;.<br>
&gt; (Object subclass: #MyClass instanceVariableNames: &#39;&#39;<br>
&gt; classVariableNames: &#39;&#39; poolDictionaries: &#39;&#39; category: &#39;Test&#39;) compile:<br>
&gt; &#39;test  self halt.  ^ super test, &#39;&#39;my super call lands on myself!&#39;&#39;&#39;.<br>
&gt; (Smalltalk classNamed: #MyClass) rename: &#39;MyNewAbstraction&#39;.<br>
&gt; ((Smalltalk classNamed: #MyNewAbstraction) subclass: #MyClass<br>
&gt; instanceVariableNames: &#39;&#39; classVariableNames: &#39;&#39; poolDictionaries: &#39;&#39;<br>
&gt; category: &#39;Test&#39;).<br>
&gt; (Smalltalk classNamed: #MyClass) new test<br>
&gt;<br>
&gt; Do-it on the above.  When the debugger appears, simply highlight the<br>
&gt; code &quot;super test&quot; in the debugger and press &quot;Print It&quot;.<br>
&gt;<br>
&gt; I expected to see &#39;Hello from Object&#39; but it seems to be calculating<br>
&gt; super from the receiver class rather than the method&#39;s home class...<br>
&gt;<br>
&gt; WITHOUT Bert and Tobias&#39; fix, the above results in the super call<br>
&gt; truly landing on itself, and if you take the halt out, the<br>
&gt; tight-recursion I mentioned from teh first paragraph of this thread.<br>
&gt; WITH their fix, the problem only manifests in the debugger as<br>
&gt; demonstrated.<br>
<br>
</span>If you hit step-into, you actually end up in the Superclass.<br>
_Only_ if you select &#39;super test&#39; and PrintIt (or DoIt), the<br>
apparent “recursion” is triggered.<br>
  This is due to the way DoIt work, they compile an anonymous class<br>
that are “homed” in the receivers class, in this case MyClass. Hence,<br>
super ends up in MyNewAbstraction[1].<br>
  Yes, this is a bit surprising, but I don&#39;t know whether it is wrong.<br>
<br>
<br>
Compiler&gt;&gt;evaluate:in:to:notifying:ifFail:logged:<br>
<br>
calculates the home class of the DoIt via this:<br>
<br>
        | theClass |<br>
        theClass := ((aContext == nil ifTrue: [receiver] ifFalse: [aContext receiver]) class).<br>
<br>
that is, the _Receiver_ of the context, not the home class of the context&#39;s method.<br></blockquote><div><br></div><div>Yes, well found.  Whereas if we used</div><div><br></div><div><span style="color:rgb(0,0,0);font-size:13px">        | theClass |</span><br style="color:rgb(0,0,0);font-size:13px"><span style="color:rgb(0,0,0);font-size:13px">        theClass := aContext ifNil: [receiver class] ifFalse: [aContext methodClass]</span><br style="color:rgb(0,0,0);font-size:13px"></div><div><span style="color:rgb(0,0,0);font-size:13px"><br></span></div><div><span style="color:rgb(0,0,0);font-size:13px">we would get the behaviour Chris is (rightly) expecting.</span></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
@Bert, Eliot: Which one do you think would be correct? the Stack is down below[1].<br></blockquote><div><br></div><div>So neither :-).  I think the correct code is as I wrote above, the receiver&#39;s class if no context, otherwise the context&#39;s methodClass (which of course is derived from the context&#39;s method).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<br>
<br>
Best<br>
        -Tobias<br>
<br>
<br>
[1]:<br>
<br>
Compiler&gt;&gt;evaluateCue:ifFail:<br>
        Receiver: a Compiler<br>
        Arguments and temporary variables:<br>
                aCue:   a CompilationCue<br>
                failBlock:      [closure] in Compiler&gt;&gt;evaluateCue:ifFail:logged:<br>
                methodNode:     DoItIn: ThisContext<br>
        ^ super test<br>
                method:         (MyClass&gt;&gt;#DoItIn: &quot;a CompiledMethod(374)&quot;)<br>
                value:  nil<br>
        Receiver&#39;s instance variables:<br>
                parser:         a Parser<br>
                cue:    a CompilationCue<br>
<br>
Compiler&gt;&gt;evaluateCue:ifFail:logged:<br>
        Receiver: a Compiler<br>
        Arguments and temporary variables:<br>
                aCue:   a CompilationCue<br>
                failBlock:      [closure] in [] in SmalltalkEditor(TextEditor)&gt;&gt;evaluateSelectionAnd...etc...<br>
                logFlag:        true<br>
                value:  nil<br>
        Receiver&#39;s instance variables:<br>
                parser:         a Parser<br>
                cue:    a CompilationCue<br>
<br>
Compiler&gt;&gt;evaluate:in:to:notifying:ifFail:logged:<br>
        Receiver: a Compiler<br>
        Arguments and temporary variables:<br>
                textOrStream:   a ReadStream<br>
                aContext:       MyClass(MyNewAbstraction)&gt;&gt;test<br>
                receiver:       a MyClass<br>
                aRequestor:     a SmalltalkEditor<br>
                failBlock:      [closure] in [] in SmalltalkEditor(TextEditor)&gt;&gt;evaluateSelectionAnd...etc...<br>
                logFlag:        true<br>
                theClass:       MyClass<br>
        Receiver&#39;s instance variables:<br>
                parser:         a Parser<br>
                cue:    a CompilationCue<br>
<br>
[] in SmalltalkEditor(TextEditor)&gt;&gt;evaluateSelectionAndDo:<br>
        Receiver: a SmalltalkEditor<br>
        Arguments and temporary variables:<br>
&lt;&lt;error during printing&gt;<br>
        Receiver&#39;s instance variables:<br>
                morph:  a TextMorphForEditView(3464)<br>
                selectionShowing:       false<br>
                model:  a Debugger<br>
                paragraph:      a NewParagraph<br>
                markBlock:      a CharacterBlock with index 21 and character $s and rectangle 110@0 ...etc...<br>
                pointBlock:     a CharacterBlock with index 31 and character $, and rectangle 174@0...etc...<br>
                beginTypeInIndex:       nil<br>
                emphasisHere:   {a TextColor code: (Color r: 0.0 g: 0.0 b: 0.5)}<br>
                lastParenLocation:      nil<br>
                otherInterval:  (20 to: 19)<br>
                oldInterval:    (20 to: 19)<br>
                typeAhead:      nil<br>
                styler:         nil<br>
<br>
BlockClosure&gt;&gt;on:do:<br>
        Receiver: [closure] in SmalltalkEditor(TextEditor)&gt;&gt;evaluateSelectionAndDo:<br>
        Arguments and temporary variables:<br>
                exception:      OutOfScopeNotification<br>
                handlerAction:  [closure] in SmalltalkEditor(TextEditor)&gt;&gt;evaluateSelectionAndDo...etc...<br>
                handlerActive:  true<br>
        Receiver&#39;s instance variables:<br>
                outerContext:   SmalltalkEditor(TextEditor)&gt;&gt;evaluateSelectionAndDo:<br>
                startpc:        97<br>
                numArgs:        0<br>
<br>
SmalltalkEditor(TextEditor)&gt;&gt;evaluateSelectionAndDo:<br>
        Receiver: a SmalltalkEditor<br>
        Arguments and temporary variables:<br>
                aBlock:         [closure] in [] in PluggableTextMorphPlus(PluggableTextMorph)&gt;&gt;printIt<br>
                result:         nil<br>
                rcvr:   a MyClass<br>
                ctxt:   MyClass(MyNewAbstraction)&gt;&gt;test<br>
        Receiver&#39;s instance variables:<br>
                morph:  a TextMorphForEditView(3464)<br>
                selectionShowing:       false<br>
                model:  a Debugger<br>
                paragraph:      a NewParagraph<br>
                markBlock:      a CharacterBlock with index 21 and character $s and rectangle 110@0 ...etc...<br>
                pointBlock:     a CharacterBlock with index 31 and character $, and rectangle 174@0...etc...<br>
                beginTypeInIndex:       nil<br>
                emphasisHere:   {a TextColor code: (Color r: 0.0 g: 0.0 b: 0.5)}<br>
                lastParenLocation:      nil<br>
                otherInterval:  (20 to: 19)<br>
                oldInterval:    (20 to: 19)<br>
                typeAhead:      nil<br>
                styler:         nil<br>
<br>
[] in PluggableTextMorphPlus(PluggableTextMorph)&gt;&gt;printIt<br>
        Receiver: a PluggableTextMorphPlus(473)<br>
        Arguments and temporary variables:<br>
                oldEditor:      {a SmalltalkEditor}<br>
        Receiver&#39;s instance variables:<br>
                bounds:         36@380 corner: 740@592<br>
                owner:  a PluggablePanelMorph(3130)<br>
                submorphs:      {a ScrollBar(1013) . a TransformMorph(3047)}<br>
                fullBounds:     36@380 corner: 740@592<br>
                color:  Color white<br>
                extension:      a MorphExtension (3891) [other:  (layoutFrame -&gt; a LayoutFrame) (vSc...etc...<br>
                borderWidth:    1<br>
                borderColor:    Color lightGray<br>
                model:  a Debugger<br>
                slotName:       nil<br>
                open:   false<br>
                scrollBar:      a ScrollBar(1013)<br>
                scroller:       a TransformMorph(3047)<br>
                retractableScrollBar:   false<br>
                scrollBarOnLeft:        false<br>
                getMenuSelector:        #codePaneMenu:shifted:<br>
                getMenuTitleSelector:   nil<br>
                scrollBarHidden:        nil<br>
                hasFocus:       false<br>
                hScrollBar:     a ScrollBar(2030)<br>
                textMorph:      a TextMorphForEditView(3464)<br>
                getTextSelector:        #contents<br>
                setTextSelector:        #contents:notifying:<br>
                getSelectionSelector:   #contentsSelection<br>
                hasUnacceptedEdits:     false<br>
                askBeforeDiscardingEdits:       true<br>
                selectionInterval:      (21 to: 30)<br>
                hasEditingConflicts:    false<br>
                getColorSelector:       nil<br>
                acceptAction:   nil<br>
                unstyledAcceptText:     nil<br>
                styler:         a SHTextStylerST80<br>
<br>
TextMorphForEditView(TextMorph)&gt;&gt;handleEdit:<br>
        Receiver: a TextMorphForEditView(3464)<br>
        Arguments and temporary variables:<br>
                editBlock:      [closure] in PluggableTextMorphPlus(PluggableTextMorph)&gt;&gt;printIt<br>
                result:         nil<br>
        Receiver&#39;s instance variables:<br>
                bounds:         0@0 corner: 683@18<br>
                owner:  a TransformMorph(3047)<br>
                submorphs:      #()<br>
                fullBounds:     0@0 corner: 683@18<br>
                color:  Color black<br>
                extension:      a MorphExtension (3814) [other:  (blinkStart -&gt; 1091554)]<br>
                borderWidth:    0<br>
                borderColor:    Color black<br>
                textStyle:      a TextStyle Bitmap DejaVu Sans 9<br>
                text:   a Text for &#39;test  self halt.  ^ super test, &#39;&#39;my super call lands on myse...etc...<br>
                wrapFlag:       true<br>
                paragraph:      a NewParagraph<br>
                editor:         a SmalltalkEditor<br>
                container:      nil<br>
                predecessor:    nil<br>
                successor:      nil<br>
                backgroundColor:        nil<br>
                margins:        nil<br>
                editHistory:    nil<br>
                editView:       a PluggableTextMorphPlus(473)<br>
                acceptOnCR:     false<br>
<br>
PluggableTextMorphPlus(PluggableTextMorph)&gt;&gt;printIt<br>
        Receiver: a PluggableTextMorphPlus(473)<br>
        Arguments and temporary variables:<br>
                oldEditor:      {a SmalltalkEditor}<br>
        Receiver&#39;s instance variables:<br>
                bounds:         36@380 corner: 740@592<br>
                owner:  a PluggablePanelMorph(3130)<br>
                submorphs:      {a ScrollBar(1013) . a TransformMorph(3047)}<br>
                fullBounds:     36@380 corner: 740@592<br>
                color:  Color white<br>
                extension:      a MorphExtension (3891) [other:  (layoutFrame -&gt; a LayoutFrame) (vSc...etc...<br>
                borderWidth:    1<br>
                borderColor:    Color lightGray<br>
                model:  a Debugger<br>
                slotName:       nil<br>
                open:   false<br>
                scrollBar:      a ScrollBar(1013)<br>
                scroller:       a TransformMorph(3047)<br>
                retractableScrollBar:   false<br>
                scrollBarOnLeft:        false<br>
                getMenuSelector:        #codePaneMenu:shifted:<br>
                getMenuTitleSelector:   nil<br>
                scrollBarHidden:        nil<br>
                hasFocus:       false<br>
                hScrollBar:     a ScrollBar(2030)<br>
                textMorph:      a TextMorphForEditView(3464)<br>
                getTextSelector:        #contents<br>
                setTextSelector:        #contents:notifying:<br>
                getSelectionSelector:   #contentsSelection<br>
                hasUnacceptedEdits:     false<br>
                askBeforeDiscardingEdits:       true<br>
                selectionInterval:      (21 to: 30)<br>
                hasEditingConflicts:    false<br>
                getColorSelector:       nil<br>
                acceptAction:   nil<br>
                unstyledAcceptText:     nil<br>
                styler:         a SHTextStylerST80<br>
<br>
Debugger(StringHolder)&gt;&gt;perform:orSendTo:<br>
        Receiver: a Debugger<br>
        Arguments and temporary variables:<br>
                selector:       #printIt<br>
                otherTarget:    a PluggableTextMorphPlus(473)<br>
        Receiver&#39;s instance variables:<br>
                dependents:     a DependentsArray(a PluggableSystemWindow(1857) a PluggableListMorp...etc...<br>
                contents:       a Text for &#39;test  self halt.  ^ super test, &#39;&#39;my super call lands on ...etc...<br>
                currentCompiledMethod:  nil<br>
                contentsSymbol:         #source<br>
                multiWindowState:       nil<br>
                interruptedProcess:     a Process in Debugger class&gt;&gt;morphicOpenOn:context:label:co...etc...<br>
                interruptedController:  nil<br>
                contextStack:   an OrderedCollection(MyClass(Object)&gt;&gt;halt MyClass(MyNewAbstracti...etc...<br>
                contextStackIndex:      2<br>
                contextStackList:       an OrderedCollection(&#39;MyClass(Object)&gt;&gt;halt&#39; &#39;MyClass(MyNewAb...etc...<br>
                receiverInspector:      an Inspector<br>
                contextVariablesInspector:      a ContextVariablesInspector<br>
                externalInterrupt:      false<br>
                proceedValue:   nil<br>
                selectingPC:    true<br>
                savedCursor:    ((CursorWithMask<br>
        extent: 16@16<br>
        depth: 1<br>
        fromArray: #(<br>
                2r0<br>
                2...etc...<br>
                isolationHead:  nil<br>
                failedProject:  nil<br>
                errorWasInUIProcess:    true<br>
                labelString:    nil<br>
                message:        nil<br>
                untilExpression:        nil<br>
<br>
Debugger&gt;&gt;perform:orSendTo:<br>
        Receiver: a Debugger<br>
        Arguments and temporary variables:<br>
                selector:       #printIt<br>
                otherTarget:    a PluggableTextMorphPlus(473)<br>
                result:         nil<br>
        Receiver&#39;s instance variables:<br>
                dependents:     a DependentsArray(a PluggableSystemWindow(1857) a PluggableListMorp...etc...<br>
                contents:       a Text for &#39;test  self halt.  ^ super test, &#39;&#39;my super call lands on ...etc...<br>
                currentCompiledMethod:  nil<br>
                contentsSymbol:         #source<br>
                multiWindowState:       nil<br>
                interruptedProcess:     a Process in Debugger class&gt;&gt;morphicOpenOn:context:label:co...etc...<br>
                interruptedController:  nil<br>
                contextStack:   an OrderedCollection(MyClass(Object)&gt;&gt;halt MyClass(MyNewAbstracti...etc...<br>
                contextStackIndex:      2<br>
                contextStackList:       an OrderedCollection(&#39;MyClass(Object)&gt;&gt;halt&#39; &#39;MyClass(MyNewAb...etc...<br>
                receiverInspector:      an Inspector<br>
                contextVariablesInspector:      a ContextVariablesInspector<br>
                externalInterrupt:      false<br>
                proceedValue:   nil<br>
                selectingPC:    true<br>
                savedCursor:    ((CursorWithMask<br>
        extent: 16@16<br>
        depth: 1<br>
        fromArray: #(<br>
                2r0<br>
                2...etc...<br>
                isolationHead:  nil<br>
                failedProject:  nil<br>
                errorWasInUIProcess:    true<br>
                labelString:    nil<br>
                message:        nil<br>
                untilExpression:        nil<br>
<br>
MenuItemMorph&gt;&gt;DoIt<br>
        Receiver: a MenuItemMorph(77)&#39;print it (p)&#39;<br>
        Arguments and temporary variables:<br>
<br>
        Receiver&#39;s instance variables:<br>
                bounds:         216@558 corner: 359@576<br>
                owner:  a MenuMorph(2209)<br>
                submorphs:      #()<br>
                fullBounds:     216@558 corner: 359@576<br>
                color:  Color black<br>
                extension:      a MorphExtension (264) [other:  (layoutProperties -&gt; a LayoutPropert...etc...<br>
                font:   a StrikeFont(Bitmap DejaVu Sans 9 14)<br>
                emphasis:       0<br>
                contents:       &#39;print it (p)&#39;<br>
                hasFocus:       false<br>
                isEnabled:      true<br>
                subMenu:        nil<br>
                isSelected:     false<br>
                target:         a Debugger<br>
                selector:       #perform:orSendTo:<br>
                arguments:      {#printIt . a PluggableTextMorphPlus(473)}<br>
                icon:   Form(16x16x32)<br>
                lastMousePosition:      nil<br>
<br>
CompiledMethod&gt;&gt;valueWithReceiver:arguments:<br>
        Receiver: (MenuItemMorph&gt;&gt;#DoIt &quot;a CompiledMethod(1420)&quot;)<br>
        Arguments and temporary variables:<br>
                aReceiver:      a MenuItemMorph(77)&#39;print it (p)&#39;<br>
                anArray:        #()<br>
        Receiver&#39;s instance variables:<br>
(MenuItemMorph&gt;&gt;#DoIt &quot;a CompiledMethod(1420)&quot;)<br>
<br>
[] in SmalltalkEditor(TextEditor)&gt;&gt;debug:receiver:in:<br>
        Receiver: a SmalltalkEditor<br>
        Arguments and temporary variables:<br>
&lt;&lt;error during printing&gt;<br>
        Receiver&#39;s instance variables:<br>
                morph:  a TextMorphForEditView(4064)<br>
                selectionShowing:       false<br>
                model:  an ObjectExplorer<br>
                paragraph:      a NewParagraph<br>
                markBlock:      a CharacterBlock with index 1 and character $s and rectangle 0@0 cor...etc...<br>
                pointBlock:     a CharacterBlock with index 62 and rectangle 366@0 corner: 366@16<br>
 ...etc...<br>
                beginTypeInIndex:       nil<br>
                emphasisHere:   {a TextFontChange font: 2}<br>
                lastParenLocation:      nil<br>
                otherInterval:  (61 to: 61)<br>
                oldInterval:    (55 to: 54)<br>
                typeAhead:      a WriteStream<br>
                styler:         nil<br>
<br>
[] in BlockClosure&gt;&gt;newProcess<br>
        Receiver: [closure] in SmalltalkEditor(TextEditor)&gt;&gt;debug:receiver:in:<br>
        Arguments and temporary variables:<br>
<br>
        Receiver&#39;s instance variables:<br>
                outerContext:   SmalltalkEditor(TextEditor)&gt;&gt;debug:receiver:in:<br>
                startpc:        112<br>
                numArgs:        0<br>
<br>
<br>
--- The full stack ---<br>
Compiler&gt;&gt;evaluateCue:ifFail:<br>
Compiler&gt;&gt;evaluateCue:ifFail:logged:<br>
Compiler&gt;&gt;evaluate:in:to:notifying:ifFail:logged:<br>
[] in SmalltalkEditor(TextEditor)&gt;&gt;evaluateSelectionAndDo:<br>
BlockClosure&gt;&gt;on:do:<br>
SmalltalkEditor(TextEditor)&gt;&gt;evaluateSelectionAndDo:<br>
[] in PluggableTextMorphPlus(PluggableTextMorph)&gt;&gt;printIt<br>
TextMorphForEditView(TextMorph)&gt;&gt;handleEdit:<br>
PluggableTextMorphPlus(PluggableTextMorph)&gt;&gt;printIt<br>
Debugger(StringHolder)&gt;&gt;perform:orSendTo:<br>
Debugger&gt;&gt;perform:orSendTo:<br>
MenuItemMorph&gt;&gt;DoIt<br>
CompiledMethod&gt;&gt;valueWithReceiver:arguments:<br>
[] in SmalltalkEditor(TextEditor)&gt;&gt;debug:receiver:in:<br>
[] in BlockClosure&gt;&gt;newProcess<br>
<br>
<br><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">best,<div>Eliot</div></div>
</div></div>