Skip to content
Prev 33642 / 63424 Next

S4 Generics and NAMESPACE : justified warning ?

Yohan Chalabi wrote:
Hi Yohan --

Commenting as a user, there's no guarantee that the 'plot' generic
defined in pkgA is derived from graphics::plot via setGeneric; pkgA
could define it's own generic, and one would want to be informed of the
collision.

Maintenance of packages that have used simple 'import' to pull in all
dependencies is tedious, but using 'import' in some ways undermines
benefits of name spaces (restricting the symbol lookup table to reduce
the number of symbols and the possibility of name collisions, and to
more carefully isolate code inside the package name space to changes in
imported packages or induced by the user). So I think a 'better
practice' is to explicitly import just those functions, classes, etc
that are required by the package. Maintenance of such selective imports
is much less tedious, even with complicated package dependencies. There
is an unreleased Bioconductor package to identify specific imports,
available for R-2.9.* at

  svn export
https://hedgehog.fhcrc.org/bioconductor/branches/RELEASE_2_4/madman/Rpacks/codetoolsBioC

or for the development version of R at

  svn export
https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/codetoolsBioC

with functions findExternalDeps and writeNamespaceImports. These are
fairly thoroughly tested, but perhaps not fool-proof.

Martin