[Pharo-project] Bug? ParagraphEditor do-its are not following the expected method lookup
Hi everybody! Well, maybe you are already aware of this... maybe not. I tried to find an issue about this and unless I didn't think of the right keywords, it's not there. I was debugging a template method and sudenly I found myself spending ours trying to find out why I got different results when printing the result of a message sent to super and when steping into that message and printing the (same) result there. Imagine this simple situation (I attatch the complete code and some tests so you can reproduce this): AverageTotalization inherits from Totalization. WeightedAverageTotalization inherits from AverageTotalization. Totalization>>total ^self summatory AverageTotalization>>total ^*(**super total)* / self denominator AverageTotalization>> denominator ^values size WeightedAverageTotalization>> denominator "Weights is a dictionary" ^self weights values sum If I debug aWeightedAverateTotalization total and try to print *super total * in the debugger ParagraphEditor, I'll get this result: (self summatory / self denominator) instead of just: self summatory This only happens when I print or inspect or other do-its in the debugger window. The method lookup works OK when just evaluating the code (the tests I made are green). I think that when you print or inspect (etc) *super total*, the evaluation context takes WeightedAverageTotalization class instead of AverageTotalization, so when total is sent to super under that context, the code is looked up on AverageTotalization instead of Totalization. Could that be possible? Am I thinking right? I spent a *while* chasing this bug, and I found a solution, but I don't know if it's OK or if it's the best. It's simple and it seems to work. I tested it in the last PharoCore1.1 unstable image. I attach some code to reproduce the error (you'll get a halt when you run the test, read the comments, the problem is clear when you run the weighted average test), and the code that fixes this. If you confirm that this was not a known issue, I'll register it on the issue tracker with both these attachments. If it was a known issue... well, I learned :) (I think XD) Cheers! Carla.
Oh, I forgot,* Compiler>>compiledMethodFor: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock logged: logFlag* has no senders. Was that replaced by* Compiler>>evaluate: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock logged: logFlag *? On Tue, May 18, 2010 at 3:52 AM, Carla F. Griggio <carla.griggio@gmail.com>wrote:
Hi everybody!
Well, maybe you are already aware of this... maybe not. I tried to find an issue about this and unless I didn't think of the right keywords, it's not there.
I was debugging a template method and sudenly I found myself spending ours trying to find out why I got different results when printing the result of a message sent to super and when steping into that message and printing the (same) result there.
Imagine this simple situation (I attatch the complete code and some tests so you can reproduce this):
AverageTotalization inherits from Totalization. WeightedAverageTotalization inherits from AverageTotalization.
Totalization>>total ^self summatory
AverageTotalization>>total ^*(**super total)* / self denominator
AverageTotalization>> denominator ^values size
WeightedAverageTotalization>> denominator "Weights is a dictionary" ^self weights values sum
If I debug aWeightedAverateTotalization total and try to print *super total* in the debugger ParagraphEditor, I'll get this result:
(self summatory / self denominator)
instead of just:
self summatory
This only happens when I print or inspect or other do-its in the debugger window. The method lookup works OK when just evaluating the code (the tests I made are green).
I think that when you print or inspect (etc) *super total*, the evaluation context takes WeightedAverageTotalization class instead of AverageTotalization, so when total is sent to super under that context, the code is looked up on AverageTotalization instead of Totalization. Could that be possible? Am I thinking right?
I spent a *while* chasing this bug, and I found a solution, but I don't know if it's OK or if it's the best. It's simple and it seems to work. I tested it in the last PharoCore1.1 unstable image.
I attach some code to reproduce the error (you'll get a halt when you run the test, read the comments, the problem is clear when you run the weighted average test), and the code that fixes this.
If you confirm that this was not a known issue, I'll register it on the issue tracker with both these attachments.
If it was a known issue... well, I learned :) (I think XD)
Cheers!
Carla.
Hi Carla. I would like to help you, but I have no idea. I could reproduce it. Maybe Lukas, Igor, Eliot etc can help you. I have no idea. Cheers Mariano 2010/5/18 Carla F. Griggio <carla.griggio@gmail.com>
Hi everybody!
Well, maybe you are already aware of this... maybe not. I tried to find an issue about this and unless I didn't think of the right keywords, it's not there.
I was debugging a template method and sudenly I found myself spending ours trying to find out why I got different results when printing the result of a message sent to super and when steping into that message and printing the (same) result there.
Imagine this simple situation (I attatch the complete code and some tests so you can reproduce this):
AverageTotalization inherits from Totalization. WeightedAverageTotalization inherits from AverageTotalization.
Totalization>>total ^self summatory
AverageTotalization>>total ^*(**super total)* / self denominator
AverageTotalization>> denominator ^values size
WeightedAverageTotalization>> denominator "Weights is a dictionary" ^self weights values sum
If I debug aWeightedAverateTotalization total and try to print *super total* in the debugger ParagraphEditor, I'll get this result:
(self summatory / self denominator)
instead of just:
self summatory
This only happens when I print or inspect or other do-its in the debugger window. The method lookup works OK when just evaluating the code (the tests I made are green).
I think that when you print or inspect (etc) *super total*, the evaluation context takes WeightedAverageTotalization class instead of AverageTotalization, so when total is sent to super under that context, the code is looked up on AverageTotalization instead of Totalization. Could that be possible? Am I thinking right?
I spent a *while* chasing this bug, and I found a solution, but I don't know if it's OK or if it's the best. It's simple and it seems to work. I tested it in the last PharoCore1.1 unstable image.
I attach some code to reproduce the error (you'll get a halt when you run the test, read the comments, the problem is clear when you run the weighted average test), and the code that fixes this.
If you confirm that this was not a known issue, I'll register it on the issue tracker with both these attachments.
If it was a known issue... well, I learned :) (I think XD)
Cheers!
Carla.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Just reproducing it would be helpful :O a friend of mine already tested the code I attatched and saw the same problem. If you recall having a class with a method sending a message to super, and a sublclass inheriting that method, you can try to reproduce it there too debugging that message on an instance of the subclass. It's not easy to explain with words, that's why I made a little package of code to illustrate the situation. The thing is that when printing the evaluation of a selected bunch of code inside a debugger window (paragraphEditor?), if the code you're evaluating is a message to super, and the class of the object you're debugging is inheriting the method you're debugging, the printed result will be wrong. In other words, the method lookup fails. This doesn't happen with normal excution of code (thank God!). I think this is an important bug, seeing those wrong results when debugging can be very confusing. I spent hours feeling stupid last Monday while debugging because I trusted those wrong results and couldn't see where I was doing something wrong :P Cheers! Carla On Wednesday, May 19, 2010, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
Hi Carla. I would like to help you, but I have no idea. I could reproduce it.
Maybe Lukas, Igor, Eliot etc can help you. I have no idea.
Cheers
Mariano
2010/5/18 Carla F. Griggio <carla.griggio@gmail.com> Hi everybody! Well, maybe you are already aware of this... maybe not. I tried to find an issue about this and unless I didn't think of the right keywords, it's not there.
I was debugging a template method and sudenly I found myself spending ours trying to find out why I got different results when printing the result of a message sent to super and when steping into that message and printing the (same) result there.
Imagine this simple situation (I attatch the complete code and some tests so you can reproduce this): AverageTotalization inherits from Totalization.WeightedAverageTotalization inherits from AverageTotalization.
Totalization>>total
^self summatory
AverageTotalization>>total
     ^(super total) / self denominator
AverageTotalization>> denominator
     ^values size
WeightedAverageTotalization>> denominator
"Weights is a dictionary"
^self weights values sum
If I debug aWeightedAverateTotalization total  and try to print super total in the debugger ParagraphEditor, I'll get this result:
(self summatory / self denominator)
instead of just: self summatory This only happens when I print or inspect or other do-its in the debugger window. The method lookup works OK when just _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Yes this is an important bug do you have the cs of your little example? Stef On May 19, 2010, at 9:17 PM, Carla F. Griggio wrote:
Just reproducing it would be helpful :O a friend of mine already tested the code I attatched and saw the same problem.
If you recall having a class with a method sending a message to super, and a sublclass inheriting that method, you can try to reproduce it there too debugging that message on an instance of the subclass.
It's not easy to explain with words, that's why I made a little package of code to illustrate the situation.
The thing is that when printing the evaluation of a selected bunch of code inside a debugger window (paragraphEditor?), if the code you're evaluating is a message to super, and the class of the object you're debugging is inheriting the method you're debugging, the printed result will be wrong. In other words, the method lookup fails.
This doesn't happen with normal excution of code (thank God!).
I think this is an important bug, seeing those wrong results when debugging can be very confusing. I spent hours feeling stupid last Monday while debugging because I trusted those wrong results and couldn't see where I was doing something wrong :P
Cheers! Carla
On Wednesday, May 19, 2010, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
Hi Carla. I would like to help you, but I have no idea. I could reproduce it.
Maybe Lukas, Igor, Eliot etc can help you. I have no idea.
Cheers
Mariano
2010/5/18 Carla F. Griggio <carla.griggio@gmail.com> Hi everybody! Well, maybe you are already aware of this... maybe not. I tried to find an issue about this and unless I didn't think of the right keywords, it's not there.
I was debugging a template method and sudenly I found myself spending ours trying to find out why I got different results when printing the result of a message sent to super and when steping into that message and printing the (same) result there.
Imagine this simple situation (I attatch the complete code and some tests so you can reproduce this): AverageTotalization inherits from Totalization.WeightedAverageTotalization inherits from AverageTotalization.
Totalization>>total
^self summatory
AverageTotalization>>total
^(super total) / self denominator
AverageTotalization>> denominator
^values size
WeightedAverageTotalization>> denominator
"Weights is a dictionary"
^self weights values sum
If I debug aWeightedAverateTotalization total and try to print super total in the debugger ParagraphEditor, I'll get this result:
(self summatory / self denominator)
instead of just: self summatory This only happens when I print or inspect or other do-its in the debugger window. The method lookup works OK when just _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Not the cs, I have an st. It's in the first email of this thread. I also attached a cs with a possible fix. On Wed, May 19, 2010 at 4:35 PM, Stéphane Ducasse <stephane.ducasse@inria.fr
wrote:
Yes this is an important bug do you have the cs of your little example?
Stef
On May 19, 2010, at 9:17 PM, Carla F. Griggio wrote:
Just reproducing it would be helpful :O a friend of mine already tested the code I attatched and saw the same problem.
If you recall having a class with a method sending a message to super, and a sublclass inheriting that method, you can try to reproduce it there too debugging that message on an instance of the subclass.
It's not easy to explain with words, that's why I made a little package of code to illustrate the situation.
The thing is that when printing the evaluation of a selected bunch of code inside a debugger window (paragraphEditor?), if the code you're evaluating is a message to super, and the class of the object you're debugging is inheriting the method you're debugging, the printed result will be wrong. In other words, the method lookup fails.
This doesn't happen with normal excution of code (thank God!).
I think this is an important bug, seeing those wrong results when debugging can be very confusing. I spent hours feeling stupid last Monday while debugging because I trusted those wrong results and couldn't see where I was doing something wrong :P
Cheers! Carla
On Wednesday, May 19, 2010, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
Hi Carla. I would like to help you, but I have no idea. I could reproduce it.
Maybe Lukas, Igor, Eliot etc can help you. I have no idea.
Cheers
Mariano
2010/5/18 Carla F. Griggio <carla.griggio@gmail.com> Hi everybody! Well, maybe you are already aware of this... maybe not. I tried to find an issue about this and unless I didn't think of the right keywords, it's not there.
I was debugging a template method and sudenly I found myself spending ours trying to find out why I got different results when printing the result of a message sent to super and when steping into that message and printing the (same) result there.
Imagine this simple situation (I attatch the complete code and some tests so you can reproduce this): AverageTotalization inherits from Totalization.WeightedAverageTotalization inherits from AverageTotalization.
Totalization>>total
^self summatory
AverageTotalization>>total
^(super total) / self denominator
AverageTotalization>> denominator
^values size
WeightedAverageTotalization>> denominator
"Weights is a dictionary"
^self weights values sum
If I debug aWeightedAverateTotalization total and try to print super total in the debugger ParagraphEditor, I'll get this result:
(self summatory / self denominator)
instead of just: self summatory This only happens when I print or inspect or other do-its in the debugger window. The method lookup works OK when just
Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Well, just to let you know, I've submitted a fix to PharoInbox: Name: SLICE-superBugInParagraphEditor-carlaGriggio.1 Author: carlaGriggio Time: 24 May 2010, 2:33:50 am UUID: 94ff9a49-b4ba-488b-9470-777e0f1885a7 Ancestors: SLICE-superBugInParagraphEditor-carlaGriggio.1 Dependencies: Compiler-carlaGriggio.212, CompilerTests-carlaGriggio.42, Kernel-carlaGriggio.665, ParagraphEditor-Test-carlaGriggio.1 But I can't change the status of the issue to fixed :P On Wed, May 19, 2010 at 4:51 PM, Carla F. Griggio <carla.griggio@gmail.com>wrote:
Not the cs, I have an st. It's in the first email of this thread. I also attached a cs with a possible fix.
On Wed, May 19, 2010 at 4:35 PM, Stéphane Ducasse < stephane.ducasse@inria.fr> wrote:
Yes this is an important bug do you have the cs of your little example?
Stef
On May 19, 2010, at 9:17 PM, Carla F. Griggio wrote:
Just reproducing it would be helpful :O a friend of mine already tested the code I attatched and saw the same problem.
If you recall having a class with a method sending a message to super, and a sublclass inheriting that method, you can try to reproduce it there too debugging that message on an instance of the subclass.
It's not easy to explain with words, that's why I made a little package of code to illustrate the situation.
The thing is that when printing the evaluation of a selected bunch of code inside a debugger window (paragraphEditor?), if the code you're evaluating is a message to super, and the class of the object you're debugging is inheriting the method you're debugging, the printed result will be wrong. In other words, the method lookup fails.
This doesn't happen with normal excution of code (thank God!).
I think this is an important bug, seeing those wrong results when debugging can be very confusing. I spent hours feeling stupid last Monday while debugging because I trusted those wrong results and couldn't see where I was doing something wrong :P
Cheers! Carla
On Wednesday, May 19, 2010, Mariano Martinez Peck < marianopeck@gmail.com> wrote:
Hi Carla. I would like to help you, but I have no idea. I could reproduce it.
Maybe Lukas, Igor, Eliot etc can help you. I have no idea.
Cheers
Mariano
2010/5/18 Carla F. Griggio <carla.griggio@gmail.com> Hi everybody! Well, maybe you are already aware of this... maybe not. I tried to find an issue about this and unless I didn't think of the right keywords, it's not there.
I was debugging a template method and sudenly I found myself spending ours trying to find out why I got different results when printing the result of a message sent to super and when steping into that message and printing the (same) result there.
Imagine this simple situation (I attatch the complete code and some tests so you can reproduce this): AverageTotalization inherits from Totalization.WeightedAverageTotalization inherits from AverageTotalization.
Totalization>>total
^self summatory
AverageTotalization>>total
^(super total) / self denominator
AverageTotalization>> denominator
^values size
WeightedAverageTotalization>> denominator
"Weights is a dictionary"
^self weights values sum
If I debug aWeightedAverateTotalization total and try to print super total in the debugger ParagraphEditor, I'll get this result:
(self summatory / self denominator)
instead of just: self summatory This only happens when I print or inspect or other do-its in the debugger window. The method lookup works OK when just
Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
cool! Stef On May 24, 2010, at 8:04 AM, Carla F. Griggio wrote:
Well, just to let you know, I've submitted a fix to PharoInbox:
Name: SLICE-superBugInParagraphEditor-carlaGriggio.1 Author: carlaGriggio Time: 24 May 2010, 2:33:50 am UUID: 94ff9a49-b4ba-488b-9470-777e0f1885a7 Ancestors: SLICE-superBugInParagraphEditor-carlaGriggio.1 Dependencies: Compiler-carlaGriggio.212, CompilerTests-carlaGriggio.42, Kernel-carlaGriggio.665, ParagraphEditor-Test-carlaGriggio.1
But I can't change the status of the issue to fixed :P
On Wed, May 19, 2010 at 4:51 PM, Carla F. Griggio <carla.griggio@gmail.com> wrote: Not the cs, I have an st. It's in the first email of this thread. I also attached a cs with a possible fix.
On Wed, May 19, 2010 at 4:35 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Yes this is an important bug do you have the cs of your little example?
Stef
On May 19, 2010, at 9:17 PM, Carla F. Griggio wrote:
Just reproducing it would be helpful :O a friend of mine already tested the code I attatched and saw the same problem.
If you recall having a class with a method sending a message to super, and a sublclass inheriting that method, you can try to reproduce it there too debugging that message on an instance of the subclass.
It's not easy to explain with words, that's why I made a little package of code to illustrate the situation.
The thing is that when printing the evaluation of a selected bunch of code inside a debugger window (paragraphEditor?), if the code you're evaluating is a message to super, and the class of the object you're debugging is inheriting the method you're debugging, the printed result will be wrong. In other words, the method lookup fails.
This doesn't happen with normal excution of code (thank God!).
I think this is an important bug, seeing those wrong results when debugging can be very confusing. I spent hours feeling stupid last Monday while debugging because I trusted those wrong results and couldn't see where I was doing something wrong :P
Cheers! Carla
On Wednesday, May 19, 2010, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
Hi Carla. I would like to help you, but I have no idea. I could reproduce it.
Maybe Lukas, Igor, Eliot etc can help you. I have no idea.
Cheers
Mariano
2010/5/18 Carla F. Griggio <carla.griggio@gmail.com> Hi everybody! Well, maybe you are already aware of this... maybe not. I tried to find an issue about this and unless I didn't think of the right keywords, it's not there.
I was debugging a template method and sudenly I found myself spending ours trying to find out why I got different results when printing the result of a message sent to super and when steping into that message and printing the (same) result there.
Imagine this simple situation (I attatch the complete code and some tests so you can reproduce this): AverageTotalization inherits from Totalization.WeightedAverageTotalization inherits from AverageTotalization.
Totalization>>total
^self summatory
AverageTotalization>>total
^(super total) / self denominator
AverageTotalization>> denominator
^values size
WeightedAverageTotalization>> denominator
"Weights is a dictionary"
^self weights values sum
If I debug aWeightedAverateTotalization total and try to print super total in the debugger ParagraphEditor, I'll get this result:
(self summatory / self denominator)
instead of just: self summatory This only happens when I print or inspect or other do-its in the debugger window. The method lookup works OK when just _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (3)
-
Carla F. Griggio -
Mariano Martinez Peck -
Stéphane Ducasse