Is there any way of accessing return value of a function that is being traced by a function specified as exit param to trace? 
That sounds hard to understand, but I was not able to simplify the question without loosing the information. So here is a simple example. 

We have a simple function 

add10 <- function(a){ 
  a + 10 
}

And some function that we want to be called when call to add10 exits. 

trace.exit() <- function(){ 
... 
}

Tracing is set up the following way. 

trace(add10, exit=trace.exit)

And we do a call to add10 

add10(5)

As I understand of right now, trace.exit will be called using on.exit through .doTrace after add10 finished executing. Is there any way to access return value of add10 inside trace.exit? 

The reason for doing so is a wish to capture all calls to some function and return values they give. My intention is not to come up with decorator pattern, but to use existing tracing functionality. 

I've asked this question in StackOverflow also, but so far no answer (http://stackoverflow.com/questions/24687062/how-to-access-a-return-value-of-a-function-that-is-being-traced)

Thanks,
Roman Tsegelskyi

	[[alternative HTML version deleted]]

