On 08/28/2014 05:52 AM, Hadley Wickham wrote:
I'd say: Depends is a historical artefact from ye old days before
package namespaces. Apart from depending on a specific version of R,
you should basically never use depends. (The one exception is, as
mentioned in R-exts, if you're writing something like latticeExtras
that doesn't make sense unless lattice is already loaded).
Keeping this nuance in mind when when discussing Depends vs Imports is
important so as to not suggest that there isn't any reason to use Depends
any longer.
A common case in Bioconductor is that a package defines a class and methods
intended for the user; this requires the package to be on the search path
(else the user wouldn't be able to do anything with the returned object). A
class and supporting methods can represent significant infrastructure, so
that it makes sense to separate these in distinct packages. It is not
uncommon to find 3-5 or more packages in the Depends: field of derived
packages for this reason.
For that scenario, is it reasonable to say that every package in
depends must also be in imports?
Important to pay attention to capitalization here. A package listed in Depends:
_never_ needs to be listed in Imports:, but will often be import()'ed (in one
way or another) in the NAMESPACE. Some would argue that listing a package in
Depends: and Imports: in this case clarifies intent -- provides functionality
available to the user, and important for the package itself. Others (such as R
CMD check) view the replication as redundancy.
I think one can imagine scenarios where a package in the Depends: fields does
not actually have anything import()'ed, e.g., PkgA defines a class, PkgB
provides some special functionality that returns the class PkgC use PkgB's
special functionality without ever manipulating the object of PkgA.
Martin Morgan
Hadley
--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109
Location: Arnold Building M1 B861
Phone: (206) 667-2793
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel