That point has already been discussed in #92, but it is really its own thing:
What about very long strings that don't contain a carriage return, and can't thus be properly displayed with the triple quote syntax in editors with limited width?
Three solutions were proposed so far:
# Java/Javascript style
key = "First part, " +
"second part and " +
"third part."
# Ignore embedded CR/LF/CLRF
key = "First part,
second part and
third part"
# C style
key = "First part, "
"second part and "
"third part."
I don't like the second style, because it forces you to unindent the text.
I proposed the third style, but I'm now partial to the first one, because it is more explicit. For example, a coma forgotten in an array would trigger a syntax error, rather than concatenate values.
Thoughts?
Why not just use arrays?
long-string = [
"Do you see any new lines?",
"I know I don't.",
"You're right. Definitely no new lines.",
]
Just about every language has facilities for concatenating a list of strings into one string. (Typically in the language's standard library.)
This supposes that the host application supports that scenario. It may not be the case (a config file user may not have the possibility to change the code).
How about this:
"""
This is a very very very \
long sentence \
that is all \
in one line.
"""
This proposal is discussed further in issue #92.
Closed in favor of moving discussion to #225.
For anybody else. This ended up 4 PRs deep, so to save you some time: https://github.com/toml-lang/toml/pull/232
val = """
This is
a mulitline
string
"""
Most helpful comment
For anybody else. This ended up 4 PRs deep, so to save you some time: https://github.com/toml-lang/toml/pull/232