> From: "Binder, Martin" <ma.bin...@campus.lmu.de>
> To: r-devel@r-project.org
> Subject: [Rd] bug: deparse sometimes omits parentheses for unary
>       operators
>
> Example (bad):
> > (expr = substitute(-a * 10, list(a = quote(if (TRUE) 1 else 0))))
> -if (TRUE) 1 else 0 * 10
>
> The parentheses around the "if"-construct are missing. The expected
> output (the true representation of the expression) is, in fact:
>
> -(if (TRUE) 1 else 0) * 10


It would also be OK for the result to be

  (-if (TRUE) 1 else 0) * 10

It's possible that producing this form is more natural for the deparser.

There are a number of other bugs in the deparser, many of which I
fixed in the pqR deparser when doing a major rewrite, though I missed
the one you report above.  You can see them at

    http://www.pqr-project.org/NEWS.txt

Look for BUG FIXES under VERSION RELEASED 2015-09-14.  Some are fixed
in R-3.4.0, but most remain.

   Radford Neal

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to