I'm trying to interleave some behavior in the normal execution flow. 

For this I do something like


   targetCtx := self findTargetContext.
   interleavedCtx := [ self doSomething ] asContext.
   interleavedCtx swapSender: (targetCtx swapSender: interleavedCtx).

Basically this works pretty fine. Now I have the case that targetCtx returns a 
value that was assigned to a variable in the original code

   bar := self methodOfTheTargetCtx

What is a good way to get the return value of targetCtx? I think there is an 
easy way but I didn't find it. Even my very hacky tries failed. I did a manual 
test by having

   interleavedCtx := [ | foo |
      foo := self dummySend
      …
   ]

and setting the pc of the context just after the "send: dummySend" which is 
"popIntoTemp: 1". I thought at least that should bring the return value to foo 
but it didn't work.

Maybe I'm doing just something stupid on the way. Some hints for enlightenment 
would be fine.

thanks,

Norbert
 

   

Reply via email to