From plummer@iarc.fr  Fri Nov  7 14:21:26 1997
From: plummer@iarc.fr (Martyn Plummer)
Date: Fri, 07 Nov 1997 15:21:26 +0100 (MET)
Subject: R-alpha: "invisible" : R_INVISIBLE .. -- repeat{} gives BOMB
Message-ID: <XFMail.971107153147.plummer@iarc.fr>

On 06-Nov-97 maechler@stat.math.ethz.ch wrote:
>I investigated some more:  
>       R_VISIBLE is set to 0  ``R_Visible = 0;''
>        also in other places in eval.c :
>
> line  C function
>               
>  344:   do_if
>  436:   do_for
>  480:   do_while
>  515:   do_repeat
>  720:    \
>  727:     > do_set
>  738:    /
>  ^^^
>(line numbers from current 0.60)
>
>In my opinion, only the three cases in do_set ("<-" things) should have
>the invisibility flag...

In S-PLUS, for, while and repeat all return invisible answers, so for
compatibility these should probably be kept. Note that S-PLUS can behave
pretty strangely with this kind of example. Try this (but type carefully!)

n<-0
repeat{ if(n==0) break }->x

Now try printing x, or indeed doing anything else with it.

>
>###-------- THIS IS EVEN WORSE:   Segmentation violation !!! -----
>
>testrep <- function(n = 1) c(1, repeat {n <- n-1; if(n<=0) break})
>testrep()
>##R : Process R:1 segmentation violation at Thu Nov  6 11:36:27 1997

Try initializing t to R_NilValue in do_repeat (eval.c).

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


R-alpha: "invisible" : R_INVISIBLE .. -- repeat{} gives BOMB
Martyn Plummer