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
This means that S3 methods that work on environments don't work when you call the generic function.
as.list(ann)
## Error in as.vector(x, "list") : ## cannot coerce type 'environment' to vector of type 'list'
traceback()
## 2: as.list.default(ann)## 1: as.list(ann)
as.list.environment(ann) works as expected, but these specific methods are often internal to packages and not available.
It would be useful if R6 objects had class c("R6", "environment").
The text was updated successfully, but these errors were encountered:
Personally, I am not sure. The environment is the implementation, but if you want an opaque type, then you don't want to inherit from it. What if in the future R6 will have a different implementation? E.g. a couple of environments instead of one? (Which it is, if you consider private members.)
Also, non-portable classes are different, there the environment includes self AFAIR.
I've thought about this before and I've been on the fence whether to add environment as a class. But I think the idea of having as.list.R6 makes sense.
Here's the first example from the R6 vignette:
ann
is an environment, but its class doesn't inherit from environment.This means that S3 methods that work on environments don't work when you call the generic function.
as.list.environment(ann)
works as expected, but these specific methods are often internal to packages and not available.It would be useful if R6 objects had class
c("R6", "environment")
.The text was updated successfully, but these errors were encountered: