[Pharo-dev] [Spy] How to inject code *inside* a method

Alexandre Bergel alexandre.bergel at me.com
Fri Dec 6 09:46:34 EST 2013


Hi Roberto,

Unfortunately injecting code in the middle of a method is not supported by Spy. Bifrost does this (http://scg.unibe.ch/research/bifrost). However it may not properly work on Pharo 3.

Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On Dec 6, 2013, at 6:00 AM, Roberto Minelli <roberto.minelli at usi.ch> wrote:

> Hi guys,
> 
> I am using Spy for my project, and I need to do something which, on top of my knowledge, is not supported.
> 
> Here is the point: Spy allows to insert code before (#beforeRun:with:in:) and after (#afterRun:with:in:) and works perfectly.
> 
> Now suppose I want to inject some code *inside* the method, e.g.,
> 
> aMethodToBeProfiled
> 
> 	do something
> 
> 	"Injected code accessing some fields of the current instance of this object”
> 	Transcript show: self field asString.
> 
> Is there any support for this?
> 
> Thanks in advance,
> R
> 





More information about the Pharo-dev mailing list