From paboyoun at fhcrc.org  Tue Sep  8 21:21:48 2009
From: paboyoun at fhcrc.org (Patrick Aboyoun)
Date: Tue, 08 Sep 2009 12:21:48 -0700
Subject: [Rd] Difference between is(<<arg>>, "ANY") and extends(<<arg>>,
	"ANY")
In-Reply-To: <4AA69E7F.3030702@fhcrc.org>
References: <4A8998CD.7070708@fhcrc.org>
	<4AA682FB.2000201@fhcrc.org>	<92984B14-5FA3-4080-B935-E53BBEF4FEAD@r-project.org>	<7F75A342-607E-4F69-B6DF-D9BA84F1B980@r-project.org>
	<4AA69E7F.3030702@fhcrc.org>
Message-ID: <4AA6AECC.5030504@fhcrc.org>

Forgive the multiple posts, but I am resending a issue under a new 
subject so it doesn't get lost. There is 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



[Rd] Difference between is(<<arg>>, "ANY") and extends(<<arg>>, "ANY")
Patrick Aboyoun