I have a piece of undocumented software that I need understand ... One thing I would like to do is to have a complete trace of method calls (receivers, parameters) for certain scenarios.
As an "aspects"guy, my first idea was to use Phantom, but it seems not active anymore.
Could someone please point me to some tools that I could use for this? (using Pharo 6, 6.1 or 7)
Thanks in advance
it may not be actively maintained but Phantom has recently been ported to Pharo 6/6.1 https://github.com/InesSosa95/PHANtom
You could also use Reflectivity (look for MetaLink class), which should not be hard to understand if you are familiar with aspects (although that is not aspects).
For example, if you wanted to trace the receivers and parameters of a method named #mWithArg1:withArg2:withArg3: in class C, you could do :
link := MetaLink new.
link control: #before.
link arguments: #(#receiver #arguments).
link metaObject: YourMetaObject.
link selector: #yourMethodWithArg1:andArg:.
(C lookupSelector: #mWithArg1:withArg2:withArg3:) ast link: link
YourMetaObject is here an object which will receive the yourMethodWithArg1:andArg: with as arguments the receiver of the method #mWithArg1:withArg2:withArg3: and its arguments as an array.
It could be a block with 2 arguments, or any other object that you would use to implement your trace behavior. You have a number of reifications available that you can pass as arguments from the context, look for subclasses of RFReification.
Le 2018-07-27 17:25, Arturo Zambrano a écrit :
that's a good news :)
I was not aware of MetaLink. Thank you!
If you want some projects using metalinks for inspiration:
(the second one also has a link to PDF explaining it in more detail)
Also here an example http://blog.yuriy.tymch.uk/2016/02/vigorous-caching-in-pharo-or-how-i-used.html
On Wed, Aug 1, 2018 at 2:21 PM, Arturo Zambrano <[hidden email]> wrote:
Thanks Peter! it is really helpful
On Wed, Aug 1, 2018 at 12:14 PM Peter Uhnák <[hidden email]> wrote:
|Free forum by Nabble||Edit this page|