Hi
I continued to code a little tool based on code of Alain to detect deadcode, so far I'm too sick to have clear idea why it freezes on Morph. However it works on ClockMorph and IconicButton. If you want to have fun save your image before MCHttpRepository location: 'http://www.squeaksource.com/MetaF' This package got inspired heavily by code given by Alain Plantec. It was further improved by S. Ducasse and S. Denier who got great fun in designing it. The basic principle is the following one: rename all methods of a class: XXX -> NOTSENTXXX. but before install #doesNotUnderstand: and #recompileNotSent:, so that, for a not understood message named YYY, if NOTSENTYYY exists, then, NOTSENTYYY is dynamically renamed YYY and then, message is resent. Deals also with superclass methods that were hidden (and could be accessible due to the previous strategy), by recompiling them locally with the default behavior to recompile themselves into the NOTSEND associated one when executed. 1 March 2009 Known Issues: ---------------- - freezes when applied on Morph Stef _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Stéphane Ducasse wrote:
> Hi > > I continued to code a little tool based on code of Alain to detect > deadcode, so far I'm too sick to have clear > idea why it freezes on Morph. This kinda reminds me of that moment in the horror film when you want to yell "Don't go in there!" at the characters on the screen. Colin _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
>> I continued to code a little tool based on code of Alain to detect
>> deadcode, so far I'm too sick to have clear >> idea why it freezes on Morph. > > This kinda reminds me of that moment in the horror film when you > want to > yell "Don't go in there!" at the characters on the screen. lol Except that you should do it from within the film itself and sit down watching ourselves. :) Stef _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
>>> I continued to code a little tool based on code of Alain to detect
>>> deadcode, so far I'm too sick to have clear >>> idea why it freezes on Morph. >> >> This kinda reminds me of that moment in the horror film when you >> want to >> yell "Don't go in there!" at the characters on the screen. > > lol > > Except that you should do it from within the film itself and sit down > watching ourselves. > :) May be I should use reflectivity or byesurgeon for that. But I'm curious to see until where we can go expecially since the dnu method and automatic recompilation is in place before transforming the methods. Something else which is striking is that it is easier to redo a root hierarchy than doing a root morph ProtoObject subclass then.... doesNotUnderstand: aMessage | sel category | sel := aMessage selector. Transcript show: 'Does not understand ', aMessage selector printString ; cr. category := (Morph organization categoryOfElement: sel). self class compile: (Morph sourceCodeAt: sel) classified: category. ^ aMessage sentTo: self. works for Object but not for Morph. Stef _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
On Mar 2, 2009, at 09:06 , Stéphane Ducasse wrote: >>>> I continued to code a little tool based on code of Alain to detect >>>> deadcode, so far I'm too sick to have clear >>>> idea why it freezes on Morph. >>> >>> This kinda reminds me of that moment in the horror film when you >>> want to >>> yell "Don't go in there!" at the characters on the screen. >> >> lol >> >> Except that you should do it from within the film itself and sit down >> watching ourselves. >> :) > > May be I should use reflectivity or byesurgeon for that. ...or use objects as methods or method wrappers. I did a quick experiment with the package http://www.squeaksource.com/ObjectsAsMethodsWrap.html from Markus Gälli. Just had to fix the send of #removeSeletorSimply: with #removeSelectorSilently: to make it work (@Markus, could you add this or give me write access?). ((PackageInfo named: 'Morphic') classes gather: [ :each | ObjectAsOneTimeMethodWrapper installOnClass: each ]) inspect gets you a collection of wrapper objects which you can ask #executed. I opened all tools and menus in the image and got 2100 methods executed out of 6518. HTH, Adrian > > But I'm curious to see until where we can go expecially since > the dnu method and automatic recompilation is in place before > transforming > the methods. > > Something else which is striking is that it is easier to redo a root > hierarchy than > doing a root morph > > ProtoObject subclass then.... > > doesNotUnderstand: aMessage > > | sel category | > sel := aMessage selector. > Transcript show: 'Does not understand ', aMessage selector > printString ; cr. > category := (Morph organization categoryOfElement: sel). > self class compile: (Morph sourceCodeAt: sel) classified: category. > ^ aMessage sentTo: self. > > works for Object but not for Morph. > > Stef > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
>>
> ...or use objects as methods or method wrappers. I did a quick > experiment with the package > > http://www.squeaksource.com/ObjectsAsMethodsWrap.html > > from Markus Gälli. Just had to fix the send of #removeSeletorSimply: > with #removeSelectorSilently: to make it work (@Markus, could you add > this or give me write access?). > > ((PackageInfo named: 'Morphic') classes gather: [ :each | > ObjectAsOneTimeMethodWrapper installOnClass: each ]) inspect > > gets you a collection of wrapper objects which you can ask #executed. > I opened all tools and menus in the image and got 2100 methods > executed out of 6518. Cool I was doing because I thought that may be I could get a problem with superclass method :) doesNotUnderstand: aMessage | sel | sel := aMessage selector. (Morph selectors includes: sel) ifTrue: [^ self copyMethod: aMessage from: Morph]. (Object selectors includes: sel) ifTrue: [ self copyMethod: aMessage from: Object]. ^ aMessage sentTo: self. copyMethod: sel from: aClass | category | Transcript show: 'Does not understand ', sel ; cr. category := (aClass organization categoryOfElement: sel). self class compile: (aClass sourceCodeAt: sel) classified: category. Transcript show: 'recompiled', sel printString ; cr. Stef _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by Adrian Lienhard
Now I get something somehow working with
copyMethod: sel from: aClass | category | Transcript show: 'Does not understand ', sel asString ; cr. category := (aClass organization categoryOfElement: sel). self class compile: (aClass sourceCodeAt: sel) classified: category. Transcript show: 'recompiled', sel asString ; cr. doesNotUnderstand: aMessage | sel | sel := aMessage selector. (Morph selectors includes: sel) ifTrue: [^ self copyMethod: sel from: Morph]. (Object selectors includes: sel) ifTrue: [ self copyMethod: sel from: Object]. ^ aMessage sentTo: self. I still would like to understand why the previous approach (alain- based) does not work with Morph so I will continue my little journey. stef _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
I'm realizing that the second approach (creating an empty class and
filling it up) does not help to really curve out functionality since sometimes you cannot exercise easily On Mar 2, 2009, at 12:24 PM, Stéphane Ducasse wrote: > Now I get something somehow working with > > copyMethod: sel from: aClass > > | category | > Transcript show: 'Does not understand ', sel asString ; cr. > category := (aClass organization categoryOfElement: sel). > self class compile: (aClass sourceCodeAt: sel) classified: category. > Transcript show: 'recompiled', sel asString ; cr. > > > doesNotUnderstand: aMessage > > | sel | > sel := aMessage selector. > (Morph selectors includes: sel) > ifTrue: [^ self copyMethod: sel from: Morph]. > (Object selectors includes: sel) > ifTrue: [ self copyMethod: sel from: Object]. > ^ aMessage sentTo: self. > > I still would like to understand why the previous approach (alain- > based) does not work with Morph > so I will continue my little journey. > > stef > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
I traced a bit my problem (using the approach of alain: DNU
recompiling methods and recompiling the methods) on Morph, what is strange is that I could install some methods but from time to time it blocks my image. I have the impression that this is related to the UI event (I closed all windows and remov dockingsbar from the methods that I instrument but it still freezes in a non really reproduceable manner. Is there a higher priority thread refreshing everything.... I still do not understand why if the DNU reinstall the old methods, the system blocks. Building hypotheses is then difficult because I have no tool to verify them. Stef _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |