[Rd] [WISH / PATCH] possibility to split string literals across multiple lines

Hadley Wickham h.wickham at gmail.com
Fri Jun 16 15:57:30 CEST 2017


>> 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. Or you can even consider
>>
>> a <- "foo"
>> bar %>% func() %>% print()
>>
>> etc.
>>
>> I like the idea of string literals, but the C/C++ way clearly does not
>> work. The Python/Julia way might, i.e.:
>>
>> """this is a
>> multi-line
>> lineral"""
>
>
> This does look like a promising option; some more careful checking
> would be needed to make sure there aren't cases where currently
> working code would be broken.
>
> Another Python idea worth considering is the raw string notation
> r"xyx" that does not process escape sequences -- this would make
> writing things like regular expressions easier.

If this is something you would consider, we'd be happy to put together
a patch for review.

Hadley


-- 
http://hadley.nz



More information about the R-devel mailing list