[Rd] [WISH / PATCH] possibility to split string literals

Radford Neal radford at cs.toronto.edu
Thu Jun 15 16:46:47 CEST 2017


> <csardi.gabor at gmail.com>:

> I don't think it is reasonable to change the parser this way. This is
> currently valid R code:
> 
> a <- "foo"
> "bar"
> 
> and with the new syntax, it is also valid, but with a different
> meaning. 

Yes.  The meaning of that would certainly need to stay the same.

However, the following is currently invalid, but would mean what is desired 
if consecutive string literals were merged by the parser, as in C:

  a <- ("foo"
        "bar")

In practice, most uses will be of something like

  cat ("I'd like to teach "
       "the world to sing"
       "\n")

which unambigously means the right thing without further effort.

So just doing like in C seems the way to go to me.

    Radford



More information about the R-devel mailing list