R-alpha: "invisible" (yet again): a more problematic bug[let]
Martyn Plummer
plummer@iarc.fr
Thu, 06 Nov 1997 10:28:08 +0100
maechler@stat.math.ethz.ch wrote:
>
> Try this (all versions of R from 0.49 to 0.60):
>
> test0 <- function() c(1,2)
> test <- function(two = FALSE) c(1, if(two) 2)
> testR <- function(two = FALSE) return(c(1, if(two) 2))
>
> test0()# 1 2 as it should
> test() # <<<<<<<<<<<<<<<<<<<<<< INVISIBLE! @#$@!
> test(T)# 1 2
> print(test())
> print(test(T))
>
> testR() # ok; NOT invisible...
> testR(T)# 1 2
The problem seems to be in do_if (eval.c) where the R_Visible flag
is set to 0. Set it to 1 instead and your functions will work
properly. You also get
R>if(F) 2
NULL
instead of
R>if(F) 2
R>
which is consistent with S-PLUS.
Martyn
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=