-
Notifications
You must be signed in to change notification settings - Fork 0
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
Surprising but expected error with once = TRUE
when traced fn is copied
#59
Comments
This behavior should be documented somewhere with the recommendation that you should trace with If you make a copy of a traced method that is bound somewhere, that complicates things. ATM can't think of a non-deliberate case where this might happen (maybe in training scales/layout? but those aren't stateful across plots so maybe its not a problem?) |
Actually maybe there is a way to make this fail gracefully. Given that most error points for If we get a We also need to check where the error comes from though... if it's |
This might be possible if tracer function is modified such that when Lines 35 to 40 in 73df8ec
Check if this accidentally interferes with multiple traces within the same execution env though |
reprex:
The error is traceable to here: the traced method is copied and wrapped in the internal helper function
draw_key
insideggplot2:::guide_gengrob.legend
where legend drawing is resolved, so untracing the original method on exit does not spill over. So that's why you get the second trigger on the method and then the error that the traced function is not found (because the<functionWithTrace>
wrapper has been removed in the untrace)This error doesn't replicate in other contexts where such copies aren't being made. Ex: the boxplot from the readme. Tracing "compute_group" once just returns data from the first boxplot without erroring, which is the expected behavior:
The text was updated successfully, but these errors were encountered: