[Rd] R package dependency issues when namespace is not attached
Jeroen Ooms
jeroen.ooms at stat.ucla.edu
Sun May 13 22:53:49 CEST 2012
On Sun, May 13, 2012 at 1:06 PM, Martin Morgan <mtmorgan at fhcrc.org> wrote:
> On 05/13/2012 12:14 PM, Jeroen Ooms wrote:
> As a package developer, I want to have the code my package sees be exactly
> what is needed, and no more.
Exactly. That is why you probably don't use Depends, but Imports in
combination with a NAMESPACE file. Which is great, and we should
encourage that practice. But as long as 'Depends' is also supported,
this should be working properly as well.
Here a quote from
http://cran.r-project.org/doc/contrib/Leisch-CreatingPackages.pdf: "A
stronger form of dependency can be specified in the optional Depends
field listing packages which are necessary to run our code."
It think it seems reasonable to assume that when a package author
decides to use 'Depends' (for whatever reason), they want the
namespace to be available to their package. Hence I think R should
import the full namespace of packages in the Depends field. I don't
think this will generate too much overhead, because in most
circumstances, the package will be loaded and attached anyway.
Furthermore this will not slow down or affect packages that use the
better practice of specifying 'Imports' instead of 'Depends' and
explicitly import only required symbols.
More information about the R-devel
mailing list