Is anyone else concerned with the way in which the R function parser
relocates comments that occur after condional expressions in functions to
before, i.e.
fred <- function(x) {
# wonder what x is like
if (x>0) stop("Sorry non-positive x only")
# that showed x big-time!
x
}
but then fred is parsed and stored as
"fred" <-
function (x)
{
# wonder what x is like
# that showed x big-time!
if (x > 0)
stop("Sorry non-positive x only")
x
}
It turns out that my programming style often includes comments after
conditionals, and I find this re-location a bit confusing.
Cheers, Jonathan.
Jonathan Rougier Science Laboratories
Department of Mathematical Sciences South Road
University of Durham Durham DH1 3LE
"[B]egin upon the precept ... that the things we see are to be
weighed in the scale with what we know" (Meredith, 1879, The Egoist)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
J.C.Rougier@durham.ac.uk writes:> Is anyone else concerned with the way in which the R function parser > relocates comments that occur after condional expressions in functions to > before, i.e....> It turns out that my programming style often includes comments after > conditionals, and I find this re-location a bit confusing.You're not alone, it's just that nobody has had the stamina to pinpoint how exactly this happens. An even more drastic version is in glm.fit: ##-------------- end IRLS iteration ------------------------------- for (iter in 1:control$maxit) { mu.eta.val <- mu.eta(eta) .. IRLS iteration! .. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._