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

Bill Dunlap bill at insightful.com
Thu Jun 14 23:05:42 CEST 2007


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



More information about the R-devel mailing list