<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"><<a href="mailto:Das.Linux@gmx.de" target="_blank">Das.Linux@gmx.de</a>></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 <<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>> wrote:<br>
<br>
> Okay, I found the invalid super-pointer behavior.<br>
><br>
> It's a lot better with Bert & Tobias' fix, but still there to a smaller degree..<br>
><br>
> Object compile: 'test ^''Hello from Object'''.<br>
> (Object subclass: #MyClass instanceVariableNames: ''<br>
> classVariableNames: '' poolDictionaries: '' category: 'Test') compile:<br>
> 'test self halt. ^ super test, ''my super call lands on myself!'''.<br>
> (Smalltalk classNamed: #MyClass) rename: 'MyNewAbstraction'.<br>
> ((Smalltalk classNamed: #MyNewAbstraction) subclass: #MyClass<br>
> instanceVariableNames: '' classVariableNames: '' poolDictionaries: ''<br>
> category: 'Test').<br>
> (Smalltalk classNamed: #MyClass) new test<br>
><br>
> Do-it on the above. When the debugger appears, simply highlight the<br>
> code "super test" in the debugger and press "Print It".<br>
><br>
> I expected to see 'Hello from Object' but it seems to be calculating<br>
> super from the receiver class rather than the method's home class...<br>
><br>
> WITHOUT Bert and Tobias' fix, the above results in the super call<br>
> truly landing on itself, and if you take the halt out, the<br>
> tight-recursion I mentioned from teh first paragraph of this thread.<br>
> WITH their fix, the problem only manifests in the debugger as<br>
> demonstrated.<br>
<br>
</span>If you hit step-into, you actually end up in the Superclass.<br>
_Only_ if you select 'super test' 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't know whether it is wrong.<br>
<br>
<br>
Compiler>>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'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's class if no context, otherwise the context's methodClass (which of course is derived from the context'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>>evaluateCue:ifFail:<br>
Receiver: a Compiler<br>
Arguments and temporary variables:<br>
aCue: a CompilationCue<br>
failBlock: [closure] in Compiler>>evaluateCue:ifFail:logged:<br>
methodNode: DoItIn: ThisContext<br>
^ super test<br>
method: (MyClass>>#DoItIn: "a CompiledMethod(374)")<br>
value: nil<br>
Receiver's instance variables:<br>
parser: a Parser<br>
cue: a CompilationCue<br>
<br>
Compiler>>evaluateCue:ifFail:logged:<br>
Receiver: a Compiler<br>
Arguments and temporary variables:<br>
aCue: a CompilationCue<br>
failBlock: [closure] in [] in SmalltalkEditor(TextEditor)>>evaluateSelectionAnd...etc...<br>
logFlag: true<br>
value: nil<br>
Receiver's instance variables:<br>
parser: a Parser<br>
cue: a CompilationCue<br>
<br>
Compiler>>evaluate:in:to:notifying:ifFail:logged:<br>
Receiver: a Compiler<br>
Arguments and temporary variables:<br>
textOrStream: a ReadStream<br>
aContext: MyClass(MyNewAbstraction)>>test<br>
receiver: a MyClass<br>
aRequestor: a SmalltalkEditor<br>
failBlock: [closure] in [] in SmalltalkEditor(TextEditor)>>evaluateSelectionAnd...etc...<br>
logFlag: true<br>
theClass: MyClass<br>
Receiver's instance variables:<br>
parser: a Parser<br>
cue: a CompilationCue<br>
<br>
[] in SmalltalkEditor(TextEditor)>>evaluateSelectionAndDo:<br>
Receiver: a SmalltalkEditor<br>
Arguments and temporary variables:<br>
<<error during printing><br>
Receiver'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>>on:do:<br>
Receiver: [closure] in SmalltalkEditor(TextEditor)>>evaluateSelectionAndDo:<br>
Arguments and temporary variables:<br>
exception: OutOfScopeNotification<br>
handlerAction: [closure] in SmalltalkEditor(TextEditor)>>evaluateSelectionAndDo...etc...<br>
handlerActive: true<br>
Receiver's instance variables:<br>
outerContext: SmalltalkEditor(TextEditor)>>evaluateSelectionAndDo:<br>
startpc: 97<br>
numArgs: 0<br>
<br>
SmalltalkEditor(TextEditor)>>evaluateSelectionAndDo:<br>
Receiver: a SmalltalkEditor<br>
Arguments and temporary variables:<br>
aBlock: [closure] in [] in PluggableTextMorphPlus(PluggableTextMorph)>>printIt<br>
result: nil<br>
rcvr: a MyClass<br>
ctxt: MyClass(MyNewAbstraction)>>test<br>
Receiver'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)>>printIt<br>
Receiver: a PluggableTextMorphPlus(473)<br>
Arguments and temporary variables:<br>
oldEditor: {a SmalltalkEditor}<br>
Receiver'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 -> 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)>>handleEdit:<br>
Receiver: a TextMorphForEditView(3464)<br>
Arguments and temporary variables:<br>
editBlock: [closure] in PluggableTextMorphPlus(PluggableTextMorph)>>printIt<br>
result: nil<br>
Receiver'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 -> 1091554)]<br>
borderWidth: 0<br>
borderColor: Color black<br>
textStyle: a TextStyle Bitmap DejaVu Sans 9<br>
text: a Text for 'test self halt. ^ super test, ''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)>>printIt<br>
Receiver: a PluggableTextMorphPlus(473)<br>
Arguments and temporary variables:<br>
oldEditor: {a SmalltalkEditor}<br>
Receiver'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 -> 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)>>perform:orSendTo:<br>
Receiver: a Debugger<br>
Arguments and temporary variables:<br>
selector: #printIt<br>
otherTarget: a PluggableTextMorphPlus(473)<br>
Receiver's instance variables:<br>
dependents: a DependentsArray(a PluggableSystemWindow(1857) a PluggableListMorp...etc...<br>
contents: a Text for 'test self halt. ^ super test, ''my super call lands on ...etc...<br>
currentCompiledMethod: nil<br>
contentsSymbol: #source<br>
multiWindowState: nil<br>
interruptedProcess: a Process in Debugger class>>morphicOpenOn:context:label:co...etc...<br>
interruptedController: nil<br>
contextStack: an OrderedCollection(MyClass(Object)>>halt MyClass(MyNewAbstracti...etc...<br>
contextStackIndex: 2<br>
contextStackList: an OrderedCollection('MyClass(Object)>>halt' '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>>perform:orSendTo:<br>
Receiver: a Debugger<br>
Arguments and temporary variables:<br>
selector: #printIt<br>
otherTarget: a PluggableTextMorphPlus(473)<br>
result: nil<br>
Receiver's instance variables:<br>
dependents: a DependentsArray(a PluggableSystemWindow(1857) a PluggableListMorp...etc...<br>
contents: a Text for 'test self halt. ^ super test, ''my super call lands on ...etc...<br>
currentCompiledMethod: nil<br>
contentsSymbol: #source<br>
multiWindowState: nil<br>
interruptedProcess: a Process in Debugger class>>morphicOpenOn:context:label:co...etc...<br>
interruptedController: nil<br>
contextStack: an OrderedCollection(MyClass(Object)>>halt MyClass(MyNewAbstracti...etc...<br>
contextStackIndex: 2<br>
contextStackList: an OrderedCollection('MyClass(Object)>>halt' '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>>DoIt<br>
Receiver: a MenuItemMorph(77)'print it (p)'<br>
Arguments and temporary variables:<br>
<br>
Receiver'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 -> a LayoutPropert...etc...<br>
font: a StrikeFont(Bitmap DejaVu Sans 9 14)<br>
emphasis: 0<br>
contents: 'print it (p)'<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>>valueWithReceiver:arguments:<br>
Receiver: (MenuItemMorph>>#DoIt "a CompiledMethod(1420)")<br>
Arguments and temporary variables:<br>
aReceiver: a MenuItemMorph(77)'print it (p)'<br>
anArray: #()<br>
Receiver's instance variables:<br>
(MenuItemMorph>>#DoIt "a CompiledMethod(1420)")<br>
<br>
[] in SmalltalkEditor(TextEditor)>>debug:receiver:in:<br>
Receiver: a SmalltalkEditor<br>
Arguments and temporary variables:<br>
<<error during printing><br>
Receiver'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>>newProcess<br>
Receiver: [closure] in SmalltalkEditor(TextEditor)>>debug:receiver:in:<br>
Arguments and temporary variables:<br>
<br>
Receiver's instance variables:<br>
outerContext: SmalltalkEditor(TextEditor)>>debug:receiver:in:<br>
startpc: 112<br>
numArgs: 0<br>
<br>
<br>
--- The full stack ---<br>
Compiler>>evaluateCue:ifFail:<br>
Compiler>>evaluateCue:ifFail:logged:<br>
Compiler>>evaluate:in:to:notifying:ifFail:logged:<br>
[] in SmalltalkEditor(TextEditor)>>evaluateSelectionAndDo:<br>
BlockClosure>>on:do:<br>
SmalltalkEditor(TextEditor)>>evaluateSelectionAndDo:<br>
[] in PluggableTextMorphPlus(PluggableTextMorph)>>printIt<br>
TextMorphForEditView(TextMorph)>>handleEdit:<br>
PluggableTextMorphPlus(PluggableTextMorph)>>printIt<br>
Debugger(StringHolder)>>perform:orSendTo:<br>
Debugger>>perform:orSendTo:<br>
MenuItemMorph>>DoIt<br>
CompiledMethod>>valueWithReceiver:arguments:<br>
[] in SmalltalkEditor(TextEditor)>>debug:receiver:in:<br>
[] in BlockClosure>>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>