[Rd] RE: [R] debugging non-visible functions

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed 13 Oct 2004 - 20:38:00 EST

On Wed, 13 Oct 2004, Liaw, Andy wrote:

> [I'm diverting this to R-devel, as I believe my questions are more
> appropriate for that.]

Certainly. Probably the original question was, too.

> > From: Prof Brian Ripley
> [snip]
> > Luke Tierney recommends removing the NAMESPACE file during
> > development of
> > a package if you need frequent access to debug/change its functions.
> But isn't that a bit troublesome if there is a shared object to be loaded in
> the NAMESPACE file? If I rename the NAMESPACE file to something else, I
> would need to put back library.dynam() in .First.lib(), right? I thought it
> might work to write some code in .First.lib that checks for existence of
> NAMESPACE, and call libaray.dynam() conditionally. Does this sound about
> right?

.First.lib is only used if there is no NAMESPACE, so the conditioning is automatic, but otherwise yes.

And BTW, you can't just remove the installed NAMESPACE file any more: you need to remove Meta/nsInfo.rds at least -- I was implying removing the source file and re-installing (I tend to use a test library for namespace-less versions).

> On a slightly different topic: In R-2.0.0, packages with NAMESPACE no
> longer need to use the package= argument in .C/.Fortran. Does that mean if
> I remove those arguments, I should put R version >= 2.0.0 in the Depend
> field of the DESCRIPTION?

I think you should not remove the PACKAGE= (sic) arguments. There has been little (none I have seen) discussion of that change, and Duncan TL will be able to elucidate. But the reason given in NEWS to omit them relates to loading more than one versioned install of a package at once, something we were told originally by Robert G was not intended to be allowed (and that is assumed in quite a few places in the code -- there is no way to have imports from a version of a namespace, for example -- and indeed importing from versioned install of namespaces did not work in 2.0.0). Duncan?

But if you do, yes you need (R >= 2.0.0) or R CMD check in earlier versions will scold you and users could get bitten.


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
Received on Wed Oct 13 20:43:01 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:00:33 EST