Skip to content
Prev 33948 / 63424 Next

Reissue: Base "Object" class to use in S4 slot specification

Simon,
I don't want to get too deep into specific implementations here so we 
don't get stuck in the weeds. (The original issue started with a typed 
list class infrastructure in BioC's IRanges package that checked to see 
if the elements conformed to the expected class.)

To make this issue as narrow as possible for now, I'll rephrase my issue 
to be inconsistent behavior between is and extends for class ANY. All 
classes (even non-existent ones) extend ANY according to 
methods::extends, but only S4 objects are of class ANY according to 
methods::is. This could be reconciled if is() checked if 
methods:::.identC(class2, "ANY") before it performed an S3Case test.

 > is(factor(), "ANY")
[1] FALSE
 > extends("factor", "ANY")
[1] TRUE
 > is(lm(I(1:10) ~ rnorm(10)), "ANY")
[1] FALSE
 > extends("lm", "ANY")
[1] TRUE
 > sessionInfo()
R version 2.10.0 Under development (unstable) (2009-09-07 r49613)
i386-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base


Patrick
Simon Urbanek wrote: