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

2017-06-16 Thread peter dalgaard
> On 16 Jun 2017, at 21:17 , Duncan Murdoch wrote: > > paste0("this is the first part", >"this is the second part") > > If the rather insignificant amount of time it takes to execute this function > call really matters (and I'm not convinced of that), then

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

2017-06-16 Thread Duncan Murdoch
On 16/06/2017 2:04 PM, Radford Neal wrote: On Wed, 14 Jun 2017, G?bor Cs?rdi wrote: 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""" luke-tier...@uiowa.edu: This does look like a promising

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

2017-06-16 Thread Hadley Wickham
On Fri, Jun 16, 2017 at 1:14 PM, Gábor Csárdi wrote: > On Fri, Jun 16, 2017 at 7:04 PM, Radford Neal wrote: >>> On Wed, 14 Jun 2017, G?bor Cs?rdi wrote: >>> >>> > I like the idea of string literals, but the C/C++ way clearly does not >>> > work.

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

2017-06-16 Thread Gábor Csárdi
On Fri, Jun 16, 2017 at 7:04 PM, Radford Neal wrote: >> On Wed, 14 Jun 2017, G?bor Cs?rdi wrote: >> >> > 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 >> >

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

2017-06-16 Thread Hadley Wickham
>> 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

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

2017-06-15 Thread luke-tierney
On Wed, 14 Jun 2017, Gábor Csárdi wrote: 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()

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

2017-06-14 Thread Andreas Kersting
Original Message From: Hadley Wickham [mailto:h.wick...@gmail.com] Sent: Wednesday, Jun 14, 2017 2:51 PM GMT To: Simon Urbanek Cc: Andreas Kersting; r-devel@r-project.org Subject: [Rd] [WISH / PATCH] possibility to split string literals across multiple lines On Wed, Jun 14,

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

2017-06-14 Thread Gábor Csárdi
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

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

2017-06-14 Thread William Dunlap via R-devel
If you are changing the parser (which is a major change) you might consider treating strings in the C/C++ way: char *s = "A" "B"; means the same as char *s = "AB"; I am not a big fan of that syntax but it is widely used. A backslash at the end of the line leads to errors

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

2017-06-14 Thread Andreas Kersting
Original Message From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: Wednesday, Jun 14, 2017 1:36 PM GMT To: Andreas Kersting Cc: r-devel Subject: [Rd] [WISH / PATCH] possibility to split string literals across multiple lines On 14/06/2017 6:45 AM, Andreas Kersting

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

2017-06-14 Thread Serguei Sokol
Le 14/06/2017 à 12:58, Andreas Kersting a écrit : Hi, I would really like to have a way to split long string literals across multiple lines in R. ... An alternative approach could be to have something like ("aaa " "bbb") This is C-style and if the core-team decides to implement it, it could

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

2017-06-14 Thread Hadley Wickham
On Wed, Jun 14, 2017 at 8:48 AM, Simon Urbanek wrote: > As I recall this has been discussed at least a few times (unfortunately I'm > traveling so can't check the references), but the justification was never > satisfactory. > > Personally, I wouldn't mind string

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

2017-06-14 Thread Simon Urbanek
As I recall this has been discussed at least a few times (unfortunately I'm traveling so can't check the references), but the justification was never satisfactory. Personally, I wouldn't mind string continuation supported since it makes for more readable code (I had one of my packages raise a

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

2017-06-14 Thread Duncan Murdoch
On 14/06/2017 6:45 AM, Andreas Kersting wrote: On Wed, 14 Jun 2017 06:12:09 -0500, Duncan Murdoch wrote: On 14/06/2017 5:58 AM, Andreas Kersting wrote: Hi, I would really like to have a way to split long string literals across multiple lines in R. I don't

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

2017-06-14 Thread Joris Meys
Hi Mark, I got you. I just pointed out the obvious to illustrate why your emulation didn't eliminate the need for the real thing. I didn't mean to imply you weren't aware of this, even though it may seem so. Sometimes I'm not 100% aware of the subtleties of the English language. This seems one of

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

2017-06-14 Thread Mark van der Loo
I know it doesn't cause construction at parse time, and it was also not what I said. What I meant was that it makes the syntax at least look a little as if you have a line-breaking character within string literals. Op wo 14 jun. 2017 om 14:18 schreef Joris Meys : > Mark,

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

2017-06-14 Thread Joris Meys
Mark, that's actually a fair statement, although your extra operator doesn't cause construction at parse time. You still call paste0(), but just add an extra layer on top of it. I also doubt that even in gigantic loops the benefit is going to be significant. Take following example: atestfun <-

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

2017-06-14 Thread Mark van der Loo
Having some line-breaking character for string literals would have benefits as string literals can then be constructed parse-time rather than run-time. I have run into this myself a few times as well. One way to at least emulate something like that is the following. `%+%` <- function(x,y)

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

2017-06-14 Thread Andreas Kersting
On Wed, 14 Jun 2017 06:12:09 -0500, Duncan Murdoch wrote: > On 14/06/2017 5:58 AM, Andreas Kersting wrote: > > Hi, > > > > I would really like to have a way to split long string literals across > > multiple lines in R. > > I don't understand why you require the string

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

2017-06-14 Thread Gábor Csárdi
On Wed, Jun 14, 2017 at 12:12 PM, Duncan Murdoch wrote: > On 14/06/2017 5:58 AM, Andreas Kersting wrote: >> >> Hi, >> >> I would really like to have a way to split long string literals across >> multiple lines in R. You can also look at the glue package, it supports

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

2017-06-14 Thread Duncan Murdoch
On 14/06/2017 5:58 AM, Andreas Kersting wrote: Hi, I would really like to have a way to split long string literals across multiple lines in R. I don't understand why you require the string to be a literal. Why not construct the long string in an expression like paste0("aaa",