R-alpha: buglet in return(invisible()) [R 0.50 and 0.60]

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Thu, 30 Oct 1997 11:29:47 +0100


Evaluate the following example to get the behavior :

		--- anybody: patch ? ---


tst.i <- function(x)
{
  if(missing(x))
    return(invisible())
  else if(!is.numeric(x)) stop("x must be numeric")
  ## else
  invisible((x+3)^2)
}

tst.i()#-- should NOT print anything !!
print(mode(tst.i()))#--gives "NULL"   both in S-plus 3.4 and R 0.60

tst.i(1)# nothing (ok in R and S-plus)
1 + tst.i(1) #> 17
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=