Closed richierocks closed 7 years ago
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.
Fair enough. I suppose I'd settle for having an as.list.R6
method that simply called as.list.environment
.
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")
.