You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> map1$clone(deep = TRUE)
Error in envRefInferField(x, what, getClass(class(x)), selfEnv) :
‘.__enclos_env__’ is not a valid field or method name for reference class “uMAPR”
> class(map1$.__enclos_env__$private$.map)
[1] "uMAPR"
attr(,"package")
[1] "mapR"
> typeof(map1$.__enclos_env__$private$.map)
[1] "S4"
But when you $-subset it with an unexisting field:
> map1$.__enclos_env__$private$.map$xxx
Error in envRefInferField(x, what, getClass(class(x)), selfEnv) :
‘xxx’ is not a valid field or method name for reference class “uMAPR”
Thus the error is caused by this piece of code in map1$clone:
deep_clone<-function(name, value) {
if (is.environment(value) &&!is.null(value$.__enclos_env__)) {
return(value$clone(deep=TRUE))
}
value
}
There is no error if one replaces !is.null(value$.__enclos_env__) with ".__enclos_env__" %in% ls(value).
By the way, there is an external pointer in this object, and the "deep clone" doesn't work: if I modify the deep clone (obtained by the above correction of map1$clone), the modification is also performed on the original object, because of the pointer.
Cheers.
The text was updated successfully, but these errors were encountered:
zeehio
added a commit
to zeehio/R6
that referenced
this issue
Apr 16, 2023
Hello,
uMAPR
is a class created with Rcpp:uMAPR <- setRcppClass("uMAPR")
Such an object is an environment:
But when you
$
-subset it with an unexisting field:Thus the error is caused by this piece of code in
map1$clone
:There is no error if one replaces
!is.null(value$.__enclos_env__)
with".__enclos_env__" %in% ls(value)
.cc @eddelbuettel
By the way, there is an external pointer in this object, and the "deep clone" doesn't work: if I modify the deep clone (obtained by the above correction of
map1$clone
), the modification is also performed on the original object, because of the pointer.Cheers.
The text was updated successfully, but these errors were encountered: