On 08/27/2014 08:33 PM, Gavin Simpson wrote:
On Aug 27, 2014 5:24 PM, "Hadley Wickham"
<snip />
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.

Martin


I am in full agreement that its use should be limited to exceptional
situations, and have modified my packages accordingly.

Cheers,

G

This check (whilst having found some things I should have imported and
didn't - which is a good thing!) seems to be circumventing the
intention of
having something in Depends. Is Depends going to go away?

I don't think it's going to go away anytime soon, but you should
consider it to be largely deprecated and you should avoid it wherever
possible.

(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.

I think that is a reasonable use case for depends. Here's the exact
text from R-exts: "Field ‘Depends’ should nowadays be used rarely,
only for packages which are intended to be put on the search path to
make their facilities available to the end user (and not to the
package itself): for example it makes sense that a user of package
latticeExtra would want the functions of package lattice made
available."

Personally I avoid even this use, requiring users of my packages to be
explicit about exactly what packages are on the search path.  You are
of course welcome to your own approach, but I think you'll find it
will become more and more difficult to maintain in time. I recommend
that you bite the bullet now.

Put another way, packages should be extremely conservative about
global side effects (and modifying the search path is such a
side-effect)

Hadley

--
http://had.co.nz/

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
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

Reply via email to