rokke
July 15, 2025, 8:13pm
1
the docs make it sound like you can continue strings:
“long lines can be broken up”
but it’s giving me an error in the repl:
julia> "This is a long \
ERROR: ParseError:
# Error @ REPL[1]:1:17
"This is a long \
# ╙ ── invalid escape sequence
Stacktrace:
[1] top-level scope
@ none:1
what am I doing wrong…
Works for me:
julia> "This is a very \
long string"
"This is a very long string"
Which Julia version do you use? Which OS? Which terminal?
rokke
July 15, 2025, 8:24pm
3
on ubuntu 22, gnome terminal, julia version 1.11.6
I thought there was some command like osinfo()
or something but can’t remember it
rokke
July 15, 2025, 8:25pm
5
julia> versioninfo()
Julia Version 1.11.6
Commit 9615af0f269 (2025-07-09 12:58 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 12 × 12th Gen Intel(R) Core(TM) i7-1265U
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, alderlake)
Threads: 1 default, 0 interactive, 1 GC (on 12 virtual cores)
If I put a space after the backslash I can reproduce the problem:
julia> "This is a very \
long string"
ERROR: ParseError:
# Error @ REPL[4]:1:17
"This is a very \
# └┘ ── invalid escape sequence
Stacktrace:
[1] top-level scope
@ none:1
The error message is bad. But if you type <backslash><enter> it just works.
rokke
July 15, 2025, 8:29pm
7
julia> "no space after\
ERROR: ParseError:
# Error @ REPL[1]:1:16
"no space after\
# ╙ ── invalid escape sequence
Stacktrace:
[1] top-level scope
@ none:1
julia> "one space after\
ERROR: ParseError:
# Error @ REPL[2]:1:17
"one space after\
# └┘ ── invalid escape sequence
Stacktrace:
[1] top-level scope
@ none:1
It seems I can continue strings with two backslashes (\) in Julia 1.11.6, but not with a single backslash
rokke
July 15, 2025, 8:35pm
9
two backslashes create a single backslash as expected on my end:
julia> "no backslashes
some text"
"no backslashes\nsome text"
julia> "two backslashes\\
some text"
"two backslashes\\\nsome text"
For me it sometimes works, sometimes it doesn’t. Could not figure out why or when yet. Also on Ubuntu and Julia 1.11.6.
Perhaps this is a Heisenbug ?
I’m also not sure what’s going on but probably an issue with JuliaSyntax.
An effective workaround is to use Alt+Enter at the end of the line and continue the string on the next line.
rokke
July 15, 2025, 8:45pm
12
alt-enter didn’t work either:
julia> "some test
more chars"
"some test\nmore chars"
using a file works though:
$ cat tmp.jl
@show "some text\
more chars"
$ julia tmp.jl
"some textmore chars" = "some textmore chars"
For me, <backslash><alt>+<enter> at the end of the line worked three times (did not try more often). I guess, worth to create a bug report. It should always work, also without using the <alt> key.
Who creates a bug report? GitHub · Where software is built
rokke
July 15, 2025, 9:00pm
14
nice! that got it for me ^^
julia> "some chars\
more"
"some charsmore"
(very much agree should work without alt; had to throw a thing together to suppress other stuff since alt-enter opens a new terminal on my system)
rokke
July 15, 2025, 9:01pm
15
it sounds like we have different bugs, so potentially both?
one created here
1 Like