[Rd] The Depends: field of a package is now used by library()

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Aug 12 17:55:02 CEST 2004


On Thu, 12 Aug 2004, Deepayan Sarkar wrote:

> On Thursday 12 August 2004 10:19, Prof Brian Ripley wrote:
> > On Thu, 12 Aug 2004, Deepayan Sarkar wrote:
> > > On Thursday 12 August 2004 07:34, Prof Brian Ripley wrote:
> > > > In R-devel, the Depends: field in the DESCRIPTION file is now
> > > > used by library() to load the named packages before the current
> > > > package, and also to set up the environment to save images and
> > > > prepare for lazy loading.
> > >
> > > How would this relate to namespaces? For instance, lattice imports
> > > grid (and a few things from stats and graphics). If I keep grid in
> > > the depends field, loading lattice does a require(grid), which
> > > defeats one of the purposes of having namespaces. If I leave it
> > > out, nothing bad seems to happen as long as grid is installed, but
> > > there should be some indication in the DESCRIPTION that that grid
> > > is a requirement. None of the other fields seem appropriate.
> >
> > It's a grey area.  As all copies of R that you are using will have
> > grid, leave it out of Depends: for lattice.
> > 
> > Perhaps we need to invent another field such as UsesNamespaces?
> 
> That should work. 
> 
> Writing R Extensions says that 
> 
> `Packages that are necessary to successfully load the package using 
> library(pkgname) must be listed in the Depends field.'
> 
> which no longer remains true. 

Well, it was never true in the sense that it was frequently broken with 
impunity!  One could argue it is still true, as package != namespace.

> Ideally, it probably would have been 
> better to keep the old behaviour of Depends, and add the new 
> functionality in a new field, but I guess this way the majority of 
> packages can remain unchanged while being able to avail the new 
> features.

Yes.  I originally suggested 'EssentialPackages' and 'RequiredPackages',
but was persuaded otherwise.  Even then, it would be good to make clear
the difference between needing a namespace to be loadable and needing a 
package attached.

I can't think of any other example of one package only needing the 
namespace of another (contributed) package.

Thanks for raising the issue.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list