On 28.08.2014 00:19, Gavin Simpson wrote:
On 27 August 2014 16:09, Dan Tenenbaum <dtene...@fhcrc.org> wrote:
----- Original Message -----
From: "Gavin Simpson" <ucfa...@gmail.com>
To: "Hadley Wickham" <h.wick...@gmail.com>
Cc: r-devel@r-project.org
Sent: Wednesday, August 27, 2014 3:01:53 PM
Subject: Re: [Rd] Re R CMD check checking in development version of R
On 27 August 2014 15:24, Hadley Wickham <h.wick...@gmail.com> wrote:
Is that the cause of these NOTEs? Is the expectation that if I am
using a
function from a package, even a package that I have in Depends:,
that I
have to explicitly declare these imports in NAMESPACE?
Yes.
(And really you shouldn't have any packages in depends, they should
all be in imports)
I disagree with *any*; having say vegan loaded when one is using
analogue
is a design decision as the latter borrows heavily from and builds
upon
vegan. In general I have moved packages that didn't need to be in
Depends
into Imports; in the version I am currently doing final tweaks on
before it
goes to CRAN I have remove all but vegan from Depends.
Or am I thinking about this in the wrong way?
I've found that if yourpkg (which Depends on theirpkg but does not import
it) has yourfunction() which calls some function in theirpkg, and if
someone else writes a package which imports yourpkg and calls yourfunction,
it will not work. Whereas if yourpkg imported theirpkg (in the NAMESPACE
file), it would work. I've had to write to many package maintainers asking
them to import things for this reason.
So that in itself is a reason not to use Depends, or at least, to be sure
that you import (in your NAMESPACE) whatever's in Depends (in addition to
Imports).
Dan
Dan,
I think we'll just have to differ on this point Dan. Why should I make it
somewhat more complicated for the people I anticipate using my package just
so that I make it easier for developers of other packages to *potentially*
write code using my packages. analogue and vegan have been around for a
long time, since before the required namespaces --- in vegan's case
possibly before there were namespaces in R (or at least before the were in
widespread use), so to change the standard behaviour of loading my package
and getting vegan too is not something I'm going to do lightly. Especially
as there are several papers out there with code written before the
compulsory namespace stuff came to R that assumed vegan was loaded because
thats what `library("analogue")` *did*.
I'm happy to work with developers on issues as they arrive of course. I
just don;t see why their envisioned future needs should trump the needs of
the user now.
If we take your and Hadley's reasoning to the extreme, not a single package
should use Depends in which case what purpose is there for Depends? Until R
Core remove Depends from DESCRIPTION and flag it under `R CMD check`-ing
people, including me, are going to continue using it if that is what they
think is best for their users.
Again, I am happy to be re-educated on this though :-)
If you like, you can fill the search path with lots of packages (and
make masking of functions more likely), but you shoudl really import
into your namesoace so that unanticipated order of packages in your
search path won't break your package.
Best,
Uwe Ligges
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel