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

Luke Tierney luke at stat.uiowa.edu
Mon Jun 18 23:36:50 CEST 2007


On Thu, 14 Jun 2007, Bill Dunlap wrote:

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

Doing some level of partial evaluation in conditionals is fairly high
on my priority list. Thinks like if (False) ... and if (is.R())
... should be fairly simple.  Platform test should also not be too
hard to handle, though ideally for those one might want to be able to
check code for sindows, say, on Linux. Handling if (require(...)) is a
little trickier as it probably isn't reasonable to unconditionally try
to execute the require's from inside checkUsage.  It may be reasonable
to allow that as an option or to assume that any require]d packages to
be ckecked have been loaded and so treat require(foo) as TRUE if foo
is loaded and FALSE otherwise.  I need to think this through a bit
more before moving ahead.

Best,

luke

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

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



More information about the R-devel mailing list