<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""><span class=""></span></div><div class=""><div class="">Reply inline. <!-- signature close --></div><div class=""><br class="">On Apr 15, 2017, at 8:48 AM, Thorsten Seitz via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">Am 15.04.2017 um 09:24 schrieb Adrian Zubarev via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>>:</div><br class="Apple-interchange-newline"><div class=""><div class="bloop_markdown" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 254);"><p style="margin: 15px 0px; -webkit-margin-before: 0px;" class="">I disagree, the examples you have provided are more complicated than you might think they are. Before explaining why, I’m going to make things clear about the ‘two modes’ of the multi-line string literal.</p><p style="margin: 15px 0px;" class="">I’m not sure where this wording has popped out first and I’m not going to search for it. IIRC Xiaodi Wu has pitched the idea before me to ban text after the starting delimiter. After Brents reply where I questioned the stripping algorithm for literals like the following one:</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code class="swift" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">"""abc
def"""
</code></pre><p style="margin: 15px 0px;" class="">I was convinced that we should not put any text before the closing delimiter to make the algorithm easier to understand. Combined with the mentioned pitch by Xiaodi Wu, I suggested to fully ban three options of the (revisited) proposed literal.</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code class="swift" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">let v1 = """abc
def"""
let v2 = """abc
def
"""
let v3 = """
abc
def"""
</code></pre><p style="margin: 15px 0px;" class="">This allows us to craft a far simpler model, which would be easy to learn and teach. Yet we haven’t removed or added new ‘modes’ from/to the model itself. I don’t think it was ever intended for<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">v1</code><span class="Apple-converted-space"> </span>to add an implicit trailing new line after<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal;" class="">"def"</code>?! The first small examples support my assumption here:</p><p style="margin: 15px 0px;" class=""><a href="https://github.com/johnno1962a/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md#simple-multi-line-string" style="color: rgb(65, 131, 196); background-color: inherit; text-decoration: none; -webkit-margin-before: 0px;" class="">https://github.com/johnno1962a/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md#simple-multi-line-string</a></p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code class="swift" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">"""Hello\↵
world!"""
// Result:
"Helloworld!"
</code></pre><p style="margin: 15px 0px;" class="">What we did so far, was only to disallow a few options on how we should not write multi-line string literals in Swift. We did not add any differentiation between the option of ‘single-lined’ tripled string literal and the one that contains more than a single content line in it. Simply as that<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">v3</code><span class="Apple-converted-space"> </span>was tweaked to have an explicit<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal;" class="">↵</code><span class="Apple-converted-space"> </span>at the end of its last content line to follow the rules, but the resulting string should remain the same.</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code class="swift" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">let from_v3_to_v4 = """
abc
def
"""
</code></pre><p style="margin: 15px 0px;" class="">Unfortunately the revisited proposal does not contain any examples like</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code class="swift" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">let str_1 = """
abc"""
let str_2 = """
abc
"""
</code></pre><p style="margin: 15px 0px;" class="">to strengthen my argumentation even further.<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">str_1</code><span class="Apple-converted-space"> </span>is an example where you could think that you’ve simply rotated the way how you’d write the literal from a single line into two lines, which as currently proposed would be totally valid and produce the<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal;" class="">"abc"</code><span class="Apple-converted-space"> </span>string.<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal;" class="">str_2</code><span class="Apple-converted-space"> </span>is the same string as<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal;" class="">str_1</code><span class="Apple-converted-space"> </span>but with adopted delimiter restrictions.</p><p style="margin: 15px 0px;" class="">Long story short, there are no different modes the literal provides for you. You cannot write (visually) multiple lines in a single content line right (except with<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">\n</code>, but that’s not what I mean here). Think about it, don’t let you fool yourself by my wording. But you should be able to write a single line in a multi line content way and still have the same result as before. This rule only applies to the last content line, but since a single line is automatically the last content line the next two literals produces the exact same string.</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code class="swift" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">let str_3 = """abc"""
let str_4 = """
abc
"""
str_3 == str_4 // => true
str_3 == "abc" // => true
</code></pre><hr style="height: 0.2em; border: 0px; color: rgb(204, 204, 204); background-color: rgb(204, 204, 204); display: inherit;" class=""><p style="margin: 15px 0px;" class="">Now it’s time to solve the puzzle in your example. The correct result should be as follows:</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code class="swift" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">(a + b) == """
This is line one
This is line twoThis is line three
This is line four
"""
// Or more precise
(a + b) == "This is line one\nThis is line twoThis is line three\nThis is line four“
</code></pre></div></div></blockquote><div class=""><br class=""></div><div class="">I disagree and think BJ Homer is right: the multiline variant contains *lines* which all end with a newline. That is a very simple mental model.<div class=""><br class=""></div><div class="">I do agree that the mixed modes (v1, v2, v3) should be banned.</div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Hi Thorsten, I think v2 would allow you to pick an <i class="">alternate</i> <i class="">style</i> to define your multiline string literal. For example, take a look at the xml string literal defined in two different ways under the <b class="">Indentation Stripping</b> section in Brent's proposal here:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/johnno1962a/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md" class="">https://github.com/johnno1962a/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md</a></div><div class=""><br class=""></div><div class=""><div class="">Here is another example:</div></div><div class=""><br class=""></div><div class=""><div class=""><div class=""><font face="Menlo" class=""><span class="" style="font-size: 11px;"><span class="Apple-tab-span" style="white-space: pre;">        </span>case .isExprSameType(let from, let to):</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span class="" style="font-size: 11px;"><span class="Apple-tab-span" style="white-space: pre;">                </span>return """</span><font color="#d12f1b" class=""><span class="" style="font-size: 11px;">checking a value with optional type </span></font><font color="#1a04ff" class="" style="font-size: 11px;">\(</font><font color="#00ab00" class="" style="font-size: 11px;"><b class="">from</b></font><font color="#1a04ff" class=""><span class="" style="font-size: 11px;">)</span></font><span class="" style="font-size: 11px;"> </span></font><span class="" style="color: rgb(26, 4, 255); font-family: Menlo; font-size: 11px;">\</span></div><div class=""><span class="Apple-tab-span" style="font-family: Menlo; font-size: 11px; white-space: pre;">                        </span><span class="" style="font-family: Menlo; font-size: 11px;"> </span><font color="#d12f1b" class="" style="font-family: Menlo;"><span class="" style="font-size: 11px;">against dynamic type</span></font><span class="" style="font-family: Menlo; font-size: 11px;"> </span><font color="#1a04ff" class="" style="font-family: Menlo;"><span class="" style="font-size: 11px;">\(</span></font><font color="#00ab00" class="" style="font-family: Menlo; font-size: 11px;"><b class="">to</b></font><font color="#1a04ff" class="" style="font-family: Menlo;"><span class="" style="font-size: 11px;">) \</span></font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="font-size: 11px; white-space: pre;">                        </span><span class="" style="font-size: 11px;"> </span><font color="#d12f1b" class=""><span class="" style="font-size: 11px;">succeeds whenever the value is non-'nil'; </span></font></font><span class="" style="color: rgb(26, 4, 255); font-family: Menlo; font-size: 11px;">\</span></div><div class=""><span class="Apple-tab-span" style="font-family: Menlo; font-size: 11px; white-space: pre;">                        </span><span class="" style="font-family: Menlo; font-size: 11px;"> </span><font face="Menlo" class=""><font color="#d12f1b" class=""><span class="" style="font-size: 11px;">did you mean to use '!= nil'?</span></font></font><span class="" style="color: rgb(26, 4, 255); font-family: Menlo; font-size: 11px;">\</span></div><div class=""><span class="Apple-tab-span" style="font-family: Menlo; font-size: 11px; white-space: pre;">                        </span><span class="" style="font-family: Menlo; font-size: 11px;"> </span><span class="" style="font-family: Menlo; font-size: 11px;">"""</span></div></div></div><div class=""><br class=""></div><div class="">I personally do not find this style confusing at all. The first line has its text begin immediately after the opening delimiter so there is no indentation that needs to be stripped from it. That is really all there is to it, IMO. Only lines two and beyond have their indentation stripped as specified by the closing delimiter. And of course, we could also use the other style:</div><div class=""><br class=""></div><div class=""><div class=""><div class=""><font face="Menlo" class=""><span class="" style="font-size: 11px;"><span class="Apple-tab-span" style="white-space: pre;">        </span>case .isExprSameType(let from, let to):</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span class="" style="font-size: 11px;"><span class="Apple-tab-span" style="white-space: pre;">                </span>return """</span></font></div><div class=""><font face="Menlo" class=""><font color="#d12f1b" class=""><span class="" style="font-size: 11px;"><span class="Apple-tab-span" style="white-space: pre;">                        </span><span class=""> </span>checking a value with optional type </span></font><font color="#1a04ff" class="" style="font-size: 11px;">\(</font><font color="#00ab00" class="" style="font-size: 11px;"><b class="">from</b></font><font color="#1a04ff" class=""><span class="" style="font-size: 11px;">)</span></font><span class="" style="font-size: 11px;"> </span></font><span class="" style="color: rgb(26, 4, 255); font-family: Menlo; font-size: 11px;">\</span></div><div class=""><span class="Apple-tab-span" style="font-family: Menlo; font-size: 11px; white-space: pre;">                        </span><span class="" style="font-family: Menlo; font-size: 11px;"> </span><font color="#d12f1b" class="" style="font-family: Menlo;"><span class="" style="font-size: 11px;">against dynamic type</span></font><span class="" style="font-family: Menlo; font-size: 11px;"> </span><font color="#1a04ff" class="" style="font-family: Menlo;"><span class="" style="font-size: 11px;">\(</span></font><font color="#00ab00" class="" style="font-family: Menlo; font-size: 11px;"><b class="">to</b></font><font color="#1a04ff" class="" style="font-family: Menlo;"><span class="" style="font-size: 11px;">) \</span></font></div><div class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="font-size: 11px; white-space: pre;">                        </span><span class="" style="font-size: 11px;"> </span><font color="#d12f1b" class=""><span class="" style="font-size: 11px;">succeeds whenever the value is non-'nil'; </span></font></font><span class="" style="color: rgb(26, 4, 255); font-family: Menlo; font-size: 11px;">\</span></div><div class=""><span class="Apple-tab-span" style="font-family: Menlo; font-size: 11px; white-space: pre;">                        </span><span class="" style="font-family: Menlo; font-size: 11px;"> </span><font face="Menlo" class=""><font color="#d12f1b" class=""><span class="" style="font-size: 11px;">did you mean to use '!= nil'?</span></font></font><span class="" style="color: rgb(26, 4, 255); font-family: Menlo; font-size: 11px;">\</span></div><div class=""><span class="Apple-tab-span" style="font-family: Menlo; font-size: 11px; white-space: pre;">                        </span><span class="" style="font-family: Menlo; font-size: 11px;"> </span><span class="" style="font-family: Menlo; font-size: 11px;">"""</span></div><div class=""><span class="" style="font-family: Menlo; font-size: 11px;"><br class=""></span></div></div></div><div class="">We get a choice to pick the one that we like better.</div><div class=""><br class=""></div><div class="">There is also an Xcode toolchain that was put together and you can try this out:</div><div class=""><br class=""></div><div class=""><a href="http://johnholdsworth.com/swift-LOCAL-2017-04-13-a-osx.tar.gz" class="">http://johnholdsworth.com/swift-LOCAL-2017-04-13-a-osx.tar.gz</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><div class=""><div class=""><div class="">-Thorsten</div><div class=""><br class=""></div></div><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class="bloop_markdown" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 254);"><hr style="height: 0.2em; border: 0px; color: rgb(204, 204, 204); background-color: rgb(204, 204, 204); display: inherit;" class=""><p style="margin: 15px 0px;" class="">One more thing to add to the story that there<span class="Apple-converted-space"> </span><em style="-webkit-margin-before: 0px;" class="">really</em><span class="Apple-converted-space"> </span>are no two different modes, but only two options of writing a single line as a consequence of the whole multi-line string literal.</p><p style="margin: 15px 0px;" class="">Without having the multi-string literal, take two text files which would each contain the following text snippets, instantiate a<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">String</code><span class="Apple-converted-space"> </span>from each of the files and concatenate the strings.</p><p style="margin: 15px 0px;" class="">First text file<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">A</code>:</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">Foo
Bar
[this is a blank line]
</code></pre><p style="margin: 15px 0px;" class="">First text file<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">B</code>:</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">Foo
Bar
</code></pre><p style="margin: 15px 0px;" class="">What’s the result you’d expect for<span class="Apple-converted-space"> </span><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">a + b</code>?</p><p style="margin: 15px 0px;" class="">It’s trivial right?</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">Foo
Bar
[this is a blank line]
Foo
Bar
</code></pre><p style="margin: 15px 0px;" class="">The exact same behavior cannot be translated into the proposed multi-line string literal because of the implicit trailing new line, but it could be when we adopt the behavior I was described above and leave the last content line without any injection.</p><p style="margin: 15px 0px;" class="">With the suggested way, you can also simply copy-paste the whole content of the files inclusion all blank lines and expect the same behavior for the concatenation.</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;" class="">let a = """
Foo
Bar
[this is a blank line]
"""
let b = """
Foo
Bar
"""
a + b == "Foo\nBar\nFoo\Bar"
</code></pre><hr style="height: 0.2em; border: 0px; color: rgb(204, 204, 204); background-color: rgb(204, 204, 204); display: inherit;" class=""><p style="margin: 15px 0px;" class="">And just another side note. The example from the revisited proposal does look fine if anyone would decide to write it like this:</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code class="swift" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">let myXMLString = """
<a href="\(url)" id="link\(i)" class="link">
"""
</code></pre><p style="margin: 15px 0px;" class="">Especially when there would be any leading and trailing quotes:</p><pre style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;" class=""><code class="swift" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">let myString = """
"Hello·world!"
"""
</code></pre><div style="margin: 15px 0px;" class=""><br class="webkit-block-placeholder"></div></div><div class="bloop_original_html" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 254);"><div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;" class=""><br class=""></div><br class=""><div id="bloop_sign_1492237191012136960" class="bloop_sign"><div style="font-family: helvetica, arial; font-size: 13px;" class="">-- <br class="">Adrian Zubarev<br class="">Sent with Airmail</div></div><br class=""><p class="airmail_on" style="margin: 15px 0px;">Am 14. April 2017 um 23:35:29, BJ Homer (<a href="mailto:bjhomer@gmail.com" style="color: rgb(65, 131, 196); background-color: inherit; text-decoration: none;" class="">bjhomer@gmail.com</a>) schrieb:</p><blockquote type="cite" class="clean_bq" style="margin: 15px 0px;"><span style="margin-top: 0px; margin-bottom: 0px;" class=""><div class=""><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class=""><span class="">let a = """</span></font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class=""><span class="">This is line one</span></font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class=""><span class="">This is line two"</span></font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class=""><span class="">"""</span></font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class=""><span class=""><br class=""></span></font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class=""><span class="">let b = """</span></font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class=""><span class="">This is line three</span></font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class=""><span class="">This is line four</span></font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class=""><span class="">"""</span></font></div><span class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></span><span style="color: rgb(10, 81, 161); font-family: helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""></span><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class="">(a + b) == """</font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class="">This is line one</font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class="">This is line two</font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class="">This is line three</font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class="">This is line four</font></div><div class="" style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><font face="Menlo" class="">"""</font></div></div></span></blockquote></div><div class="bloop_markdown" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 254);"><div style="margin: 15px 0px; -webkit-margin-before: 0px;" class=""><br class="webkit-block-placeholder"></div></div><span style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 254); float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 254);" class=""><span style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 254); float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 254);" class=""><a href="mailto:swift-evolution@swift.org" style="color: rgb(65, 131, 196); background-color: rgb(254, 254, 254); text-decoration: none; font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 254);" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="color: rgb(65, 131, 196); background-color: rgb(254, 254, 254); text-decoration: none; font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 254);" class=""></div></blockquote></div><br class=""></div></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></div></body></html>