Re: [Rd] package check note: no visible global function definition (in functions using Tcl/Tk)

From: Bill Dunlap <bill_at_insightful.com>
Date: Thu, 14 Jun 2007 14:05:42 -0700 (PDT)

On Thu, 14 Jun 2007, Prof Brian Ripley wrote:

> You may prefer the version now in R-devel: this goes slightly the other
> way in that it loads all the Suggests/Enhances packages and also a dummy
> compatibility package for platform differences. Neither this nor the
> previous version can test the conditionalization is correct, as the code
> is analysed but no path through it is run. It is entirely possible that
> the problems flagged are in code that can never be reached: this shows up
> dramatically in examples such as Hmisc with non-R code (for S3 or S4).

Splus 8 has a code-analysis routine called unresolvedGlobalReferences() that helps identify potential problems when moving R code to Splus. It is nowhere near as comprehensive as codetools::checkUsage(). However it does look for if statements of the form

   if (is.R())
and

   if (!is.R())
and won't analyze the R-only parts of the code marked by such statements. It would be nice if checkUsage() could do that as well. unresolvedGlobalReferences() does not look for anything more complicated than is.R() or !is.R() in the if statement, so it is better to change things like

   if (is.R() || version$major>=9) { # R or future version of Splus to use a more complicated arrangement of if statements, each with a simpler condition in it.

To get really fancy, checkUsage() might also look for statements like

   if (require(pkgName))
and run them both ways, to make sure the non-pkgName code really works when pkgName is not available. This might overload the nightly build machine, but would be useful for the developer.



Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146

 "All statements in this message represent the opinions of the author and do  not necessarily reflect Insightful Corporation policy or position."



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 14 Jun 2007 - 21:10:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Jun 2007 - 23:35:01 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.