-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let instrument recurse into environments #15
Comments
👍 Btw. I need to rethink |
Recursing into environments needs to be done with care, because as soon as you have reference semantics, you might have circular references and circular data structures. So we need to keep track of which environments we are already instrumenting. Probably by using the address of the environment. |
For R6 to work, I also need to go inside lists. Hopefully this won't cause any problems. |
Thanks, this seems to work for batchtools. However, I noticed that the instrumentation does not work properly with inheritance. Here is a simple example using https://github.com/mllg/bugme: bar = Bar$new(x = 12)
print(bar$getxsquare)
|
Oh, yeah, of course. I will somehow mark the already instrumented functions to avoid instrumenting them again. |
You could port |
That requires C code, unfortunately, so I would avoid it if possible. |
Unless I do some |
5 lines of C code vs obscuring a call to SEXP address(SEXP x) {
char buffer[32];
snprintf(buffer, 32, "%p", (void *)x);
return(mkString(buffer));
} What's wrong with C? |
It makes |
Actually, I can also just change the debug string, so that the second run does not pick it up. |
👍 |
Currently the package only instruments functions which are defined at top level of a package namespace. But sometimes additional functions are stored inside environments which then do not get instrumented. This is also the case for R6 classes which are stored as environment in the namespace.
The text was updated successfully, but these errors were encountered: