From dtenenba at fhcrc.org  Thu Aug 28 00:09:52 2014
From: dtenenba at fhcrc.org (Dan Tenenbaum)
Date: Wed, 27 Aug 2014 15:09:52 -0700 (PDT)
Subject: [Rd] Re R CMD check checking in development version of R
In-Reply-To: <CAAHES9yzPkidSVAW6=BE689mrfo7Bv_MHZ=WzanHwpctGC21Tg@mail.gmail.com>
Message-ID: <534513610.2281174.1409177392064.JavaMail.root@fhcrc.org>



----- Original Message -----
> From: "Gavin Simpson" <ucfagls at gmail.com>
> To: "Hadley Wickham" <h.wickham at gmail.com>
> Cc: r-devel at 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.wickham at 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.
> >
> > (Otherwise your package won't work if it's only attached and not
> > loaded. i.e. if someone does analogue::foo() only the imported
> > functions are available, not the functions in packages you depend
> > on)
> >
> 
> Cheers Hadley. Thanks for the confirmation, but...
> 
> ...I don't get this; what is the point of Depends? I thought it was
> "my
> package needs these other packages to work, i.e. be loaded". Hence it
> is
> user error (IMHO ;-) to do `analogue::foo()` without having the
> dependencies loaded too.
> 
> 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?
> 
> 
> > (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


> Thanks again
> 
> Gavin
> 
> 
> >
> > Hadley
> >
> >
> > --
> > http://had.co.nz/
> >
> 
> 
> 
> --
> Gavin Simpson, PhD
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] Re R CMD check checking in development version of R
Dan Tenenbaum