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

2007-06-18 Thread Luke Tierney
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@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 andFax:   319-335-3017
Actuarial Science
241 Schaeffer Hall  email:  [EMAIL PROTECTED]
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2007-06-14 Thread Prof Brian Ripley
On Mon, 11 Jun 2007, Seth Falcon wrote:

 Prof Brian Ripley [EMAIL PROTECTED] writes:

 It seems that is happens if package tcltk is missing from the Depends:
 list in the DESCRIPTION file.  I just tested with Amelia and homals and
 that solved the various warnings in both cases.

 Adding tcltk to Depends may not always be the desried solution.  If

But I didn't say it was (I didn't mention a solution at all). What I did 
say was that it happened if 'tcltk' was missing (which implies that it 
should have been there), and gave two of the tens of instances of this on 
CRAN.

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


 tcltk is already in Suggests, for example, and the intention is to
 optionally provide GUI features, then the code may be correct as-is.
 That is, codetools will issue the NOTEs if you have a function that
 looks like:

   f - function() {
 if (require(tckltk)) {
 someTckltkFunctionHere()
 } else
 otherwiseFunction()
 }
   }

 There are a number of packages in the BioC repository that provide
 such optional features (not just for tcltk) and it would be nice to
 have a way of declaring the use such that the NOTE is silenced.

 [Note 1: I don't have any ideas at the moment for how this could
 work.]

 [Note 2: Despite the false-positives, I've already caught a handful of
 bugs by reading over these NOTEs and think they provide a lot of value
 to the check process]

 + seth



-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2007-06-14 Thread Bill Dunlap
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2007-06-12 Thread Jari Oksanen
On Tue, 2007-06-12 at 00:42 +0200, Henrik Bengtsson wrote:
 On 6/11/07, Seth Falcon [EMAIL PROTECTED] wrote:
  Prof Brian Ripley [EMAIL PROTECTED] writes:
 
   It seems that is happens if package tcltk is missing from the Depends:
   list in the DESCRIPTION file.  I just tested with Amelia and homals and
   that solved the various warnings in both cases.
 
  Adding tcltk to Depends may not always be the desried solution.  If
  tcltk is already in Suggests, for example, and the intention is to
  optionally provide GUI features, then the code may be correct as-is.
  That is, codetools will issue the NOTEs if you have a function that
  looks like:
 
 f - function() {
   if (require(tckltk)) {
   someTckltkFunctionHere()
   } else
   otherwiseFunction()
   }
 }
 
  There are a number of packages in the BioC repository that provide
  such optional features (not just for tcltk) and it would be nice to
  have a way of declaring the use such that the NOTE is silenced.
 
 Same scenario here: I am using Suggest and I found that the NOTEs go
 away if you call the function with double-colon (::), e.g.
 tcltk::someTckltkFunctionHere().
 
 I also got several NOTEs about non-declared objects if I used
 request(pkgname), but they go away with request(pkgname).
 
The real problem here is what are the consequences for CRAN auditing
with the new defaults. Do you have to pass these tests also? Do you
implement stricter package dependence checking? Do you still allow the
check circumvention device that Henrik, perhaps unwisely, revealed here
(that is package::function)? 

Just being curious, I run checkUsagePackage() for my CRAN package
(vegan), and got 109 messages. 58 of these were local variables
assigned but may not be used and need be checked. My first impression
was that they were just harmless leftover, and removing those is not
among my top priorities, but may wait till September. Some were false
positives. Most of the rest (49 + 1 special case) were calls to
functions in other packages with require || stop in the function body.
I'd like to keep them like this, or at least with the circumvention
device. Please don't make this test a requirement in CRAN submissions!

One real error was detected also, but fixing that error broke the
function, since the rest of the function already was expecting erroneous
output to work correctly. 

I urge for more relaxed dependence checking allowing calls to other
packages in functions. I've been a Linux user since Red Hat 5.1 and I
know what is a dependence hell (package depending on package
depending ... depending on broken package). There already are some signs
of that in R, in particular in unsupported platforms like MacOS 10.3.9
where I have trouble in installing some packages that depend on
packages... (if somebody wonders why I still use MacOS 10.3.9, I can
give 129 reasons, each worth one Euro). 

cheers, Jari Oksanen

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2007-06-11 Thread Thomas Petzoldt
Hello,

when testing packages under R version 2.6.0 Under development 
(unstable), in order to discover future compatibility issues, I recently 
get numerous possible problem notes for different (own and other 
contributed) packages containing Tcl/Tk code,  e.g.:


   * checking R code for possible problems ... NOTE
   sEdit : editVec : build: no visible global function
   definition for 'tclvalue'
   sEdit : editVec : reset: no visible global function
   definition for 'tclvalue-'
   sEdit : editVec: no visible global function
   definition for 'tktoplevel'


My question:

- Is this an indication of a serious problem?
- How can one avoid (or if not possible suppress) these messages?

Thanks in advance

Thomas P.

OS: WinXP Prof., German
R 2.6.0, svn-rev. 41910, 2007-06-11



-- 
Thomas Petzoldt
Technische Universitaet Dresden
Institut fuer Hydrobiologie[EMAIL PROTECTED]
01062 Dresden  http://tu-dresden.de/hydrobiologie/
GERMANY

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2007-06-11 Thread Prof Brian Ripley
It seems that is happens if package tcltk is missing from the Depends: 
list in the DESCRIPTION file.  I just tested with Amelia and homals and 
that solved the various warnings in both cases.

This is not new in pre-2.6.0: you will get the same warnings in 2.5.0 if 
you turn codestools-checking on -- see `Writing R Extensions'.  Only the 
defaults have been changed.


On Mon, 11 Jun 2007, Thomas Petzoldt wrote:

 Hello,

 when testing packages under R version 2.6.0 Under development
 (unstable), in order to discover future compatibility issues, I recently
 get numerous possible problem notes for different (own and other
 contributed) packages containing Tcl/Tk code,  e.g.:


   * checking R code for possible problems ... NOTE
   sEdit : editVec : build: no visible global function
   definition for 'tclvalue'
   sEdit : editVec : reset: no visible global function
   definition for 'tclvalue-'
   sEdit : editVec: no visible global function
   definition for 'tktoplevel'


 My question:

 - Is this an indication of a serious problem?
 - How can one avoid (or if not possible suppress) these messages?

 Thanks in advance

 Thomas P.

 OS: WinXP Prof., German
 R 2.6.0, svn-rev. 41910, 2007-06-11





-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2007-06-11 Thread Seth Falcon
Prof Brian Ripley [EMAIL PROTECTED] writes:

 It seems that is happens if package tcltk is missing from the Depends: 
 list in the DESCRIPTION file.  I just tested with Amelia and homals and 
 that solved the various warnings in both cases.

Adding tcltk to Depends may not always be the desried solution.  If
tcltk is already in Suggests, for example, and the intention is to
optionally provide GUI features, then the code may be correct as-is.
That is, codetools will issue the NOTEs if you have a function that
looks like:

   f - function() {
 if (require(tckltk)) {
 someTckltkFunctionHere()
 } else
 otherwiseFunction()
 }
   }

There are a number of packages in the BioC repository that provide
such optional features (not just for tcltk) and it would be nice to
have a way of declaring the use such that the NOTE is silenced.

[Note 1: I don't have any ideas at the moment for how this could
work.]

[Note 2: Despite the false-positives, I've already caught a handful of
bugs by reading over these NOTEs and think they provide a lot of value
to the check process]

+ seth

-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2007-06-11 Thread Thomas Petzoldt
Dear Prof.Ripley, Dear Seth,

thank you both, including tcltk in Depends as suggested by Prof. Ripley 
immediately helped to silence the tcltk NOTEs, but Seth is also right. 
It is in fact not the ultimate solution for the Suggests case, that I 
intentionally used like in Seth's code example.

Thomas


Seth Falcon wrote:
 Prof Brian Ripley [EMAIL PROTECTED] writes:
 
 It seems that is happens if package tcltk is missing from the Depends: 
 list in the DESCRIPTION file.  I just tested with Amelia and homals and 
 that solved the various warnings in both cases.
 
 Adding tcltk to Depends may not always be the desried solution.  If
 tcltk is already in Suggests, for example, and the intention is to
 optionally provide GUI features, then the code may be correct as-is.
 That is, codetools will issue the NOTEs if you have a function that
 looks like:
 
f - function() {
  if (require(tckltk)) {
  someTckltkFunctionHere()
  } else
  otherwiseFunction()
  }
}
 
 There are a number of packages in the BioC repository that provide
 such optional features (not just for tcltk) and it would be nice to
 have a way of declaring the use such that the NOTE is silenced.
 
 [Note 1: I don't have any ideas at the moment for how this could
 work.]
 
 [Note 2: Despite the false-positives, I've already caught a handful of
 bugs by reading over these NOTEs and think they provide a lot of value
 to the check process]
 
 + seth


__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel