similar to: Specifying a long string literal across several lines

Displaying 20 results from an estimated 20000 matches similar to: "Specifying a long string literal across several lines"

2025 Jun 02
1
Specifying a long string literal across several lines
On 5/28/25 04:15, Pavel Krivitsky via R-devel wrote: > Dear All, > > Perhaps this should go in r-package-devel, but I suspect that this is > going to turn into a feature request, and I want to run it by the list > before filing it in the Bugzilla. > > I would like to specify a long string literal without making the line > of code too long. In R, > > "abc >
2025 Jun 02
1
Specifying a long string literal across several lines
Tomas, Here is a good example of where this functionality would be useful: https://github.com/R-ArcGIS/arcgislayers/blob/2b29f4c254e7e5a1dadce8d4b0015a70dfae39d4/R/arc-open.R#L19-L56 In order to prevent R CMD check notes I have to use `paste0()` to concatenate long URLs. If we were able to use `\` to separate the string across multiple lines, it would make the solution much nicer! On Mon, Jun
2025 Jun 02
1
Specifying a long string literal across several lines
On 6/2/25 17:37, Josiah Parry wrote: > Tomas, > > Here is a good example of where this functionality would be useful: > https://github.com/R-ArcGIS/arcgislayers/blob/2b29f4c254e7e5a1dadce8d4b0015a70dfae39d4/R/arc-open.R#L19-L56 > > In order to prevent R CMD check notes I have to use `paste0()` to > concatenate long URLs. If we were able to use `\` to > separate the string
2025 Jun 02
1
Specifying a long string literal across several lines
Like Tomas, I find the paste0 readability to be **much** better, partly because it allows for better indentation (as Tomas pointed out). Perhaps a pointless email, but sometimes - for these subjective issues - it is worthwhile to point out a difference in opinion. Best, Kasper On Mon, Jun 2, 2025 at 12:27?PM Tomas Kalibera <tomas.kalibera at gmail.com> wrote: > > On 6/2/25 17:37,
2025 Jun 02
2
Specifying a long string literal across several lines
One could also argue that paste0("a", "b", "c") is a function call that needs to be evaluated at runtime, whereas "abc" is a string constant understood by the parser, and often also language agnostic. I'd assume compilers and code- and text-search tools do a better job with the latter. /Henrik On Mon, Jun 2, 2025 at 2:18?PM Josiah Parry
2025 Jun 02
2
Specifying a long string literal across several lines
I suppose taste is learned as well. It does feel quite odd that the best way to define a long string without a note or text wrapping is by being creative with functions. This is valid in Python, Julia, and Rust (if you add `let` and a terminating semi-colon): my_str = "part1\ part2\ part2" I don't think it is abnormal to expect or desire this type of functionality in our favorite
2025 Jun 02
2
Specifying a long string literal across several lines
> On 3 Jun 2025, at 09:34, Henrik Bengtsson <henrik.bengtsson at gmail.com> wrote: > > One could also argue that paste0("a", "b", "c") is a function call that needs to be evaluated at runtime, whereas "abc" is a string constant understood by the parser, and often also language agnostic. I'd assume compilers and code- and text-search tools
2017 Jun 14
4
[WISH / PATCH] possibility to split string literals across multiple lines
On Wed, 14 Jun 2017 06:12:09 -0500, Duncan Murdoch <murdoch.duncan at gmail.com> 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 to be a literal. Why not > construct the long
2017 Jun 14
8
[WISH / PATCH] possibility to split string literals across multiple lines
Hi, I would really like to have a way to split long string literals across multiple lines in R. Currently, if a string literal spans multiple lines, there is no way to inhibit the introduction of newline characters: > "aaa + bbb" [1] "aaa\nbbb" If a line ends with a backslash, it is just ignored: > "aaa\ + bbb" [1] "aaa\nbbb" We could use
2017 Jun 14
2
[WISH / PATCH] possibility to split string literals across multiple lines
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 <- function(x){ y <- paste0("a very long", "string for
2017 Jun 14
2
[WISH / PATCH] possibility to split string literals across multiple lines
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
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
On 14/06/2017 6:45 AM, Andreas Kersting wrote: > On Wed, 14 Jun 2017 06:12:09 -0500, Duncan Murdoch <murdoch.duncan at gmail.com> 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
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
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) paste0(x,y) "hello" %+% " pretty" %+% " world" -Mark Op wo 14 jun.
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
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", "bbb") ? Surely the execution time of the paste0 call is
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
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 <jorismeys at gmail.com>: > Mark, that's actually a fair statement, although your extra operator > doesn't cause
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
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 when you accidently put a space after the backslash and the editor
2017 Jun 15
0
[WISH / PATCH] possibility to split string literals across multiple lines
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() > >
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
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 NOTE in examples because there is no way in R to split a long hash into multiple lines), but
2017 Jun 16
4
[WISH / PATCH] possibility to split string literals across multiple lines
> 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-tierney at uiowa.edu: > This does look like a promising option; some more careful checking
2006 Sep 25
4
Tightening the rules for literal `[` and `]` chars in link ids
So here's an interesting bug I just discovered: [Like this][d]: [here][h]. [d]: foo [h]: bar The output here should be: <a href="foo">Like this</a>: <a href="bar">here</a>. But instead the output is completely empty. I see this bug in both Markdown.pl and PHP Markdown. The problem is that all three lines are being