Skip to content
Prev 45719 / 63421 Next

Patch proposal for R style consistency (concerning deparse.c)

On 04/18/2013 11:41 AM, Yihui Xie wrote:
Me too. Note that print.function() will screw it only if you use
useSource=FALSE:

   > print.function(foo3, useSource=FALSE)
   function ()
   {
     if (FALSE) {
         letters
     }
     else {
         LETTERS
     }
   }

Otherwise, everything is fine:

   > print.function(foo3)
   function()
   {
     if (FALSE) {
         letters  # some comment
     } else {
         LETTERS
     }
   }

I can't see of any reason why useSource=FALSE would screw my nicely
formatted 'if' statement though. This formatting is ugly, unnecessarily
uses 1 more line, and the 'if' statement cannot be copy/pasted into an
interactive session anymore. So, in a way, you could even consider
this is invalid code.

Thanks,
H.