On Thu, Mar 25, 2010 at 7:31 PM, Alexandre Bergel <alexandre@bergel.eu>wrote:
Hi folks. I want to intercept (and do something) for all objects. I know
few approaches, for example:
hi Mariano,
I tried something similar, but I haven't found a satisfactory solution.
1) using method wrappers (implementing run: aSelector with: arguments in:
aReceiver) I can wrap all compiled methods of all classes and there I have the receiver.
You can wrap most of the compiled methods in the system. Not all of them, so you will have find out which one you can safely wrap.
I also noticed this too. There are some methods or classes that are so "kernel" that cannot be wrapped. And of course, the class wrapper in itself. So...do you have a list to share of the classes/methods that should not be wrapped ? In my case, for example: #new #changed #initialize #drawOn: #doesNotUnderstand: but I am not even sure. Wrapping and unwrapping all classes takes a bit of times (1-2 seconds on my
machine).
is not bad, at all.
I therefore used MessageTally to find out what I exactly need to wrap. This is not perfect (MessageTally uses a sampling profiling after all). But it is fine for now.
I didn't understand you here. What I don't understand is how MessageTally may be of help here.
2) become all objects to some kind of hacky object that stores the
original object and that redefines the doesNotUnderstand:
If you succeed, let me know.
Sure. I have been playing (no more than 2 days) and analyzing an implementation of MethodWrappers, the TestCoverage and CUIS' Protocol catcher. I just wrote some notes for myself in a simple text file. Actually to write down what I understood and not to loose it. I attached just in case you are interested. Ahhh I forgot. I am putting all these little tools here: http://www.squeaksource.com/ObjectMetaTools in case you want to take a look. Cheers Mariano
Cheers, Alexandre
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project