From ripley at stats.ox.ac.uk  Fri Oct 22 18:30:13 2004
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri Oct 22 18:30:17 2004
Subject: [Rd] Re: library.dynam() & .dynLibs() do not work as documented
In-Reply-To: <20041022161758.GA19166@wald.ucdavis.edu>
Message-ID: <Pine.LNX.4.44.0410221720520.6592-100000@gannet.stats>

Duncan,

I don't know what we want, but it is not a simple matter of documenting
what .dynLibs currently does.  What I see as bugs are

1) the inconsistent names and types of the components returned by 
   .dynLibs().
2) the inconsistent inclusion or not of R_X11 in the list returned by 
   .dynLibs().
3) the inclusion of static info (base) by library.dynam().
4) including loadable modules such as R_X11.
5) the documentation needs updating.

Having .dynLibs() give a list of DLLinfo objects about DLLs loaded by 
packages, and summarizing those in library.dynam() is my current best 
suggestion.  That implies leaving out base and R_X11.

I intended

> > nor in any sensible way we could document.

to indicate that the current documentation was not a good option.

Brian

On Fri, 22 Oct 2004, Duncan Temple Lang wrote:

> Prof Brian Ripley wrote:
> > nor in any sensible way we could document.
> > 
> > In R 2.0.0 (and current R-patched and R-devel):
> > 
> > > X11()
> > > library.dynam()
> >                                                 Filename Dynamic.Lookup
> > base                                                base          FALSE
> > stats       /usr/local/lib/R/library/stats/libs/stats.so           TRUE
> > methods /usr/local/lib/R/library/methods/libs/methods.so           TRUE
> > R_X11                  /usr/local/lib/R/modules/R_X11.so           TRUE
> > 
> > whereas 1.9.1 gives
> > 
> > > library.dynam()
> > [1] "stats"   "methods"
> > 
> > and the documentation says
> > 
> >      If 'chname' is not specified, 'library.dynam' returns a character
> >      vector with the names of packages which have used it in the
> >      current R session to load shared libraries. This vector is
> >      returned as 'invisible', unless  the 'chname' argument is missing.
> > 
> > which is clearly no longer true.  I don't see why we want loaded modules 
> > in there that have nothing to do with packages, or even non-modules.
> 
> 
> Before we try to simply match documentation which was written for
> a simpler semantic,  let's think about what we actually require
> in the context of versioned packages and where library.dynam()
> is currently being used and so what is broken.
> 
> Returning a character vector with the names of packages which have used it
> does not permit version information to be included (unless they are in the
> package name). 
> 
> For quite some time, I have wanted to move to package objects 
> and to return such self-describing objects which contain all
> their own details such as name, version, DLL, etc.  Using names,
> just   as using numbers of graphics devices, is a global mechanism
> that leads to clumsy code. 
> 
> We can make the code match the documentation, but only if
> we still want what the documentation states.
> When we introduce multiple evaluators in the future,
> lots of things will "challenge" the current semantics
> and many of them will be desirable. One of these potential changes
> is the use of multiple concurrent versions of a package.
> 
> Comments, before we fix things? 
> 
>  D. 
> 
> > 
> > At that point .dynLibs() gave
> > 
> > $base
> > DLL name: base
> > Filename: base
> > Dynamic lookup: FALSE
> > 
> > $stats
> > DLL name: stats
> > Filename: /usr/local/lib/R/library/stats/libs/stats.so
> > Dynamic lookup: TRUE
> > 
> > [[3]]
> > [1] "methods"
> > 
> > which seems useless for
> > 
> >      '.dynLibs' is used for getting or setting the packages that have
> >      loaded shared libraries (using 'library.dynam').
> > 
> > One command later and we have
> > 
> > > library(MASS)
> > > .dynLibs()
> > $base
> > DLL name: base
> > Filename: base
> > Dynamic lookup: FALSE
> > 
> > $stats
> > DLL name: stats
> > Filename: /usr/local/lib/R/library/stats/libs/stats.so
> > Dynamic lookup: TRUE
> > 
> > $methods
> > DLL name: methods
> > Filename: /usr/local/lib/R/library/methods/libs/methods.so
> > Dynamic lookup: TRUE
> > 
> > $R_X11
> > DLL name: R_X11
> > Filename: /usr/local/lib/R/modules/R_X11.so
> > Dynamic lookup: TRUE
> > 
> > [[5]]
> > [1] "MASS"
> > 
> > !
> > 
> > -- 
> > Brian D. Ripley,                  ripley@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
> 
> 

-- 
Brian D. Ripley,                  ripley@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


[Rd] Re: library.dynam() & .dynLibs() do not work as documented
Prof Brian Ripley