[Rd] clarification of library/require semantics
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Nov 4 20:06:57 CET 2005
On Fri, 4 Nov 2005, Robert Gentleman wrote:
> Recently I have added a lib.loc argument to require, so that
> it is more consistent with library. However, there are some oddities
> that folks have pointed out, and we do not have a documented description
> of the semantics for what should happen when the lib.loc parameter is
> provided.
>
> Proposal: the most common use case seems to be one where any other
> dependencies, or calls to library/require should also see the library
> specified in the lib.loc parameter for the duration of the initial call
> to library. Hence, we should modify the library search path for the
> duration of the call (via .libPaths).
>
> The alternative, is to not do that. Which is what happens now.
>
> Both have costs, automatically setting the library search path, of
> course, means that users that do not want that behavior have to manually
> remove things from their library. But if almost no one does that, and
> most folks I have asked have said they want the lib.loc parameter to be
> used for other loading.
>
> Comments?
There is a parallel set of issues with loadNamespace and the dependent
namespaces it loads. I think I would want the same semantics (whatever
they are) for loadNamespace and library.
I set my standard libraries in R_LIBS, so when I use lib.loc it is for
experimental things. So I would neither want the .libPaths changed nor
be affected if they were.
--
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