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
Strange bug with capturing namespaces #94
Comments
@wch If this involves deep digging, can you suggest some workarounds? |
The reason it happens is because the One thing you could do for now is simply wrap the function in a list, so that fun_caller = R6::R6Class(
public = list(
initialize = function(f_) self$f = list(f_),
f = list(),
call_f = function(x) self$f[[1]](x)
)
) |
First of all many thanks for the huge amount of work done by
R6
developers and contributors.I use
R6
v2.1.3.Recently I discovered a strange behaviour of
R6
classes (looks like a bug) - when instance of the class is cloned, it can't correctly capture namespace/environment of the member function.Description above can looks unclear, so it will be simpler to consider following example (my use case a little bit more complex - I use
R6
to create iterators which can apply some function to the chunk after$next()
call):check_input
- is a internal function intokenizers
package and it is not exported!However this works fine:
And this also works:
The text was updated successfully, but these errors were encountered: