[Rd] Conditional suggest
Seth Falcon
sfalcon at fhcrc.org
Tue Dec 12 22:39:53 CET 2006
Kurt wrote:
>> This is not "enhancing" the way it is currently implemented, which is
>> allowing for the possibility to provide S3 or S4 methods for classes
>> from another package without actively suggesting it (thus enhancing
>> it).
By provide an S4 method for a class, I guess you mean define a method
that includes one of the classes in its signature. In any case, I'm
pretty sure that one must have the class definition available to
define such a method -- I think this means that to define such a
method, one must have the package defining the class loaded.
So doesn't "enhancing" imply code like:
if (require("Fruit"))
setMethod("grow", "Apple", ...)
Maybe I'm missing something about how enhances is intended to work. I
admit to being a bit oversensitive on the issue. I find the current
warning about calls to require to be a bit overzelous. We have a
number of packages in Bioconductor that contain functions which
attempt to load annotation data packages, for example, and these
trigger the warning.
While in general, I think it should be possible for package authors to
say "this is a package I might load if it is available, but please do
R CMD check anyway if it is not available", it doesn't even help with
packages that want to load a data package since it is not possible to
list all possible data packages ahead of time.
I don't want to start seeing spam in package code like:
ploader <- get(paste("r", "e", "q", "u", "i", "r", "e", sep=""))
ploader("somePkg")
just to avoid a warning message. But warnings from R CMD check, for
our project, have substantially less value as more of them become "oh,
that is an OK warning message".
Maybe I've strayed too far off topic here. Sorry.
+ seth
More information about the R-devel
mailing list