Re: [Rd] .First.lib and namespaces

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Fri 03 Sep 2004 - 16:11:06 EST


On Thu, 2 Sep 2004, Deepayan Sarkar wrote:

>
> The lattice package has a namespace, so it has a .onLoad function. I
> also keep around a .First.lib, for use during development, when I
> temporarily delete the NAMESPACE file.
>
> When using a namespace, I used to comment out the .First.lib function.
> However, that seems unnecessary since it's not executed anyway. Is this
> intended (and dependable) behaviour?

Yes.

> (If so, this should probably be mentioned in ?library, which currently
> says
>
> '.First.lib' is called when a package is loaded; '.Last.lib' is
> called when a package is detached.
>
> without any mention of namespaces).

[.Last.lib is called when a package with a namespace is detached.]

Indeed, but see `Writing R Extensions', under `Load hooks', and

Various @R{} functions in a package can be used to initialize and clean up. For packages without a name space, these are @code{.First.lib} and @code{.Last.lib}. (For packages with a name space, @xref{Load hooks}.)

I'll update library.Rd to mention this and user hooks.

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

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri Sep 03 16:14:35 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:45:12 EST