[Rd] return (x+1) * 1000

Mateo Obregón obregonm@teo @end|ng |rom gm@||@com
Fri Nov 20 22:12:33 CET 2020


Dear r-developers-

After many years of using and coding in R and other languages, I came across 
something that I think should be flagged by the parser:

bug <- function (x) {
     return (x + 1) * 1000
}
> bug(1)
[1] 2

The return() call is not like any other function call that returns a value to 
the point where it was called from. I think this should straightforwardly be 
handled in the parser by flagging it as a syntactic error.

Thoughts?

Mateo.
--  
Mateo Obregón.



More information about the R-devel mailing list