"[[" strips the S4 class for classes extending environment

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

"[[" strips the S4 class for classes extending environment

Vitalie S.-2

Dear Developers,

A recently patched [[ for environment class returns a blank environment for a
children class:

setClass("myenv", contains = "environment")
#[1] "myenv"
env <- new("myenv")
class(env)
#[1] "myenv"
#attr(,"package")
#[1] ".GlobalEnv"
env[["a"]] <- 343
class(env)
[1] "environment"

It looks like not being an intended behavior.

Best,
Vitalie.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: "[[" strips the S4 class for classes extending environment

John Chambers
`[[<-`, that is.  Right, the primitive code is not retaining the
subclass information.

Should be fixed in r-devel and 2.12 patched from revision 53547.

Thanks for the catch.

On 11/10/10 3:32 AM, Vitalie S. wrote:

> Dear Developers,
>
> A recently patched [[ for environment class returns a blank environment for a
> children class:
>
> setClass("myenv", contains = "environment")
> #[1] "myenv"
> env<- new("myenv")
> class(env)
> #[1] "myenv"
> #attr(,"package")
> #[1] ".GlobalEnv"
> env[["a"]]<- 343
> class(env)
> [1] "environment"
>
> It looks like not being an intended behavior.
>
> Best,
> Vitalie.
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel