<html><head><style>
body {
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        padding:1em;
        margin:auto;
        background:#fefefe;
}

h1, h2, h3, h4, h5, h6 {
        font-weight: bold;
}

h1 {
        color: #000000;
        font-size: 28pt;
}

h2 {
        border-bottom: 1px solid #CCCCCC;
        color: #000000;
        font-size: 24px;
}

h3 {
        font-size: 18px;
}

h4 {
        font-size: 16px;
}

h5 {
        font-size: 14px;
}

h6 {
        color: #777777;
        background-color: inherit;
        font-size: 14px;
}

hr {
        height: 0.2em;
        border: 0;
        color: #CCCCCC;
        background-color: #CCCCCC;
    display: inherit;
}

p, blockquote, ul, ol, dl, li, table, pre {
        margin: 15px 0;
}

a, a:visited {
        color: #4183C4;
        background-color: inherit;
        text-decoration: none;
}

#message {
        border-radius: 6px;
        border: 1px solid #ccc;
        display:block;
        width:100%;
        height:60px;
        margin:6px 0px;
}

button, #ws {
        font-size: 12 pt;
        padding: 4px 6px;
        border-radius: 5px;
        border: 1px solid #bbb;
        background-color: #eee;
}

code, pre, #ws, #message {
        font-family: Monaco;
        font-size: 10pt;
        border-radius: 3px;
        background-color: #F8F8F8;
        color: inherit;
}

code {
        border: 1px solid #EAEAEA;
        margin: 0 2px;
        padding: 0 5px;
}

pre {
        border: 1px solid #CCCCCC;
        overflow: auto;
        padding: 4px 8px;
}

pre > code {
        border: 0;
        margin: 0;
        padding: 0;
}

#ws { background-color: #f8f8f8; }


.bloop_markdown table {
border-collapse: collapse;  
font-family: Helvetica, arial, freesans, clean, sans-serif;  
color: rgb(51, 51, 51);  
font-size: 15px; line-height: 25px;
padding: 0; }

.bloop_markdown table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }
     
.bloop_markdown table tr:nth-child(2n) {
background-color: #f8f8f8; }

.bloop_markdown table tr th {
font-weight: bold;
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }

.bloop_markdown table tr td {
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }

.bloop_markdown table tr th :first-child, table tr td :first-child {
margin-top: 0; }

.bloop_markdown table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }

.bloop_markdown blockquote{
  border-left: 4px solid #dddddd;
  padding: 0 15px;
  color: #777777; }
  blockquote > :first-child {
    margin-top: 0; }
  blockquote > :last-child {
    margin-bottom: 0; }

code, pre, #ws, #message {
    word-break: normal;
    word-wrap: normal;
}

hr {
    display: inherit;
}

.bloop_markdown :first-child {
    -webkit-margin-before: 0;
}

code, pre, #ws, #message {
    font-family: Menlo, Consolas, Liberation Mono, Courier, monospace;
}


.send { color:#77bb77; }
.server { color:#7799bb; }
.error { color:#AA0000; }</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="bloop_markdown"><p>I only had a quick glance but I quickly noticed that there were quite a lot cases which didn’t require a trailing new line, but if we’d revert this decision would require a trailing <code>\</code> over and over.</p>

<p>That would make the simplest multi-line string literal not that simple anymore:</p>

<pre><code>"""
abc
""" == "abc\n"
</code></pre>

<p>Which means we’ll see a lot of cases like:</p>

<pre><code>"""
abc\
"""
</code></pre>

<p>I obviously cannot foresee which cases would dominate, but I’d keep it like it is. Furthermore, we wanted to avoid this talk in this review anyway.</p>

<p>On the other side the ability to write <code>\</code> in the last line can be used in cases like this:</p>

<pre><code>let signatureTemplate = """
    Adrian Zubarev
    Sent with \
    """

// At some later point
let clientName = "Airmail"
print(signatureTemplate + clientName)

// prints:
// Adrian Zubarev
// Sent with Airmail
</code></pre>

<hr>

<p>And I still don’t see the need for adding this feature to <code>"</code> literals. That’s only my personal opinion! We don’t want to align Swift with other languages, especially not with the C-family. Sure we want interoperability, but that can be achieved differently. Our goal is to borrow best practices or improve things know from other languages so that we can avoid ugliness baked into other programming languages. If we’re speak about consistency for <code>\</code> than we should speak about consistency between the two literals and not other languages.</p>

<pre><code>// #1
// What does this version add to Swift (forget other languages)?!
_ = "Swift \
is awesome"

// #2 - Consistent counterpart for #1  
// (already rejected in SE-168 for good reasons)
_ = """Swift \
is awesome"""

// In theory #2 still would have indent stripping.
// This makes #1 inconsistent!
_ = """Swift \
    is \
    awesome"""
     
// I also don't think we want to debate about the  
// combination like the following one:
_ = """Swift \
    is \
    awesome
    """
     
// #3
"""
Abc
Def
"""

// #4 - Consistent counterpart for #3
// `"`- literal should stay explicit about it's content.
// Does this add anything that `"""` cannot solve better? - No!
"
Abc\n
Def\n
"
</code></pre>

<p></p></div><div class="bloop_original_html"><style>body{font-family:Helvetica,Arial;font-size:13px}</style><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div> <br> <div id="bloop_sign_1500292628028589056" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">--&nbsp;<br>Adrian Zubarev<br>Sent with Airmail</div></div> <br><p class="airmail_on">On 17. July 2017 at 13:43:07, David Hart via swift-evolution (<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div></div><div>



<title></title>


<div class="">To add a data point, I migrated the Swift Package
Manager to use Swift 4’s multi-line strings this weekend. Nearly
all of the resulting multi-line strings required an ending
new-line, forcing me to write the following pattern
everywhere:</div>
<div class=""><br class=""></div>
<div class=""><font face="Menlo" class="">let&nbsp;text
=&nbsp;""”<br class="">
&nbsp; &nbsp; lorem ipsum dolor sit amet</font></div>
<div class=""><font face="Menlo" class="">&nbsp; &nbsp; consectetur
adipiscing elit</font></div>
<div class=""><font face="Menlo" class="">&nbsp; &nbsp; sed do
eiusmod</font></div>
<div class=""><font face="Menlo" class=""><br class="">
&nbsp; &nbsp;&nbsp;“""</font></div>
<div class=""><font face="Menlo" class=""><br class=""></font></div>
<div class="">I agree that the Swift Package Manager is only one
data-point, that mostly uses multi-line strings to append string
content to files. Another project with SQL queries in multi-line
strings might not really want an ending newline.</div>
<div class=""><br class=""></div>
<div class="">For reference, here is the Pull
Request:&nbsp;<a href="https://github.com/apple/swift-package-manager/pull/1272/files" class="">https://github.com/apple/swift-package-manager/pull/1272/files</a></div>
<div class=""><br class=""></div>
<div class="">David.</div>
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 17 Jul 2017, at 13:32, John Holdsworth via
swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">

<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">As this review winds down it seems fair to say the
response has been generally
<div class="">favourable with some reservations about whether this
should be applied to single</div>
<div class="">line strings as well. I’d include single line strings
myself for consistency with multi-</div>
<div class="">line and with other languages myself but that isn’t
the focus of this proposal.</div>
<div class=""><br class=""></div>
<div class="">There has also been some discussion about whether
escaping the last newline should</div>
<div class="">be an error or ignored. For me this highlights that
the final newline should be included</div>
<div class="">in the literal and could therefore be escaped when
you want one without a newline at</div>
<div class="">the end which may or may not be the common use case
as has been discussed before.</div>
<div class=""><br class=""></div>
<div class="">
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">
<div style="margin: 0px; line-height: normal;" class="">
<span style="color: #ba2da2" class="">let</span> text =
<font color="#CF2F1B" class="">"""</font></div>
<div style="margin: 0px; line-height: normal;" class="">
<font color="#CF2F1B" class="">&nbsp; &nbsp; Lorem ipsum dolor sit
amet, consectetur adipiscing elit, sed do eiusmod \</font></div>
<div style="margin: 0px; line-height: normal;" class="">
<font color="#CF2F1B" class="">&nbsp; &nbsp; tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam,
\</font></div>
<div style="margin: 0px; line-height: normal;" class="">
<font color="#CF2F1B" class="">&nbsp; &nbsp; quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.\</font></div>
<div style="margin: 0px; line-height: normal;" class="">
<font color="#CF2F1B" class="">&nbsp; &nbsp; """</font></div>
</div>
</div>
<div class=""><br class=""></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #ba2da2" class="">let</span>
endsWithNewline = <font color="#CF2F1B" class="">"""</font></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><font color="#CF2F1B" class="">&nbsp; &nbsp; Lorem ipsum
dolor sit amet, consectetur adipiscing elit, sed do
eiusmod</font></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><font color="#CF2F1B" class="">&nbsp; &nbsp; tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam,</font></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><font color="#CF2F1B" class="">&nbsp; &nbsp; quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.</font></div>
<div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><font color="#CF2F1B" class="">&nbsp; &nbsp; "<span style="text-decoration: underline;" class="">"</span>"</font></div>
<div class=""><br class=""></div>
<div class="">While multi-line strings would loose their pleasing
symmetry from SE-0168 where initial</div>
<div class="">and final newlines are stripped I'd argue in response
that text is generally asymmetric</div>
<div class="">with files generally having no newline at the start
and a newline at the end. I can see</div>
<div class="">the arguments for both decisions though and could
live with either.</div>
<div class=""><br class=""></div>
<div class="">-John</div>
<div class="">&nbsp;
<div class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 14 Jul 2017, at 18:17, Jordan Rose via
swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="font-family: Helvetica; font-size: 12px; 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;" class=""><br class="Apple-interchange-newline">
<br class="">
<blockquote type="cite" class="">
<div class="">On Jul 14, 2017, at 10:00, Alex Blewitt &lt;<a href="mailto:alblue@apple.com" class="">alblue@apple.com</a>&gt;
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="" style="font-family: Helvetica; font-size: 12px; 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;">
<blockquote type="cite" class="">
<div class="">On 13 Jul 2017, at 23:14, David Hart via
swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="" style="font-family: Helvetica; font-size: 18px; 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;">
<blockquote type="cite" class="">
<div class=""><br class="Apple-interchange-newline">
On 14 Jul 2017, at 00:21, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space;">
[Proposal:<span class="Apple-converted-space">&nbsp;</span><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0182-newline-escape-in-strings.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0182-newline-escape-in-strings.md</a>]
<div class=""><br class=""></div>
<div class="">This is a tiny, tiny point amidst the broader
discussions others are having, but</div>
<div class=""><br class=""></div>
<div class="">
<div class="">
<blockquote type="cite" class="">• All whitespace characters
between&nbsp;\&nbsp;and the newline are disregarded.</blockquote>
<br class=""></div>
<div class="">Why? Why bother allowing whitespace characters
between \ and the newline?</div>
</div>
</div>
</div>
</blockquote>
<div class=""><br class=""></div>
<div class="">The reasoning is to be consistent with trailing
whitespace in the rest of the code: to leave that to a linter
instead. Or to see it differently, even with whitespace between \
and the newline, the programmer’s intent is still clear. Why
generate an error?</div>
</div>
</div>
</blockquote>
<br class=""></div>
<div class="" style="font-family: Helvetica; font-size: 12px; 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;">
For the same reason that code allows (e.g.) a comment at the end of
the line; you wouldn't expect (newline continuation) (comment) to
mean the same thing as if generic whitespace were added at the end.
The convention in other languages is that \ immediately precedes
the line feed to indicate a continuation, not that an orphan \ is
valid on its own.</div>
<div class="" style="font-family: Helvetica; font-size: 12px; 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;">
<br class=""></div>
<div class="" style="font-family: Helvetica; font-size: 12px; 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;">
The reason that \(newline) is valid while \(otherchar)(newline)
isn't is because \ immediately precedes another character that it
is escaping, and it's possible that \(space) would have a meaning
in the future, whereas \(newline) won't.</div>
</div>
</blockquote>
<br class=""></div>
<div style="font-family: Helvetica; font-size: 12px; 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;" class="">I agree with Alex on this, although I would be happy to
make it a warning rather than an error so that it doesn't block
compilation.</div>
<div style="font-family: Helvetica; font-size: 12px; 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;" class=""><br class=""></div>
<div style="font-family: Helvetica; font-size: 12px; 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;" class="">The point about comments is also significant: we
previously said that comments should generally be treated like
whitespace (<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0037-clarify-comments-and-operators.md" class="">SE-0037</a>). This is a little different because it's
still inside the string literal, but it's probably worth explicitly
stating "we're still inside a string literal; you can't just put
comments after the backslash".</div>
<div style="font-family: Helvetica; font-size: 12px; 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;" class=""><br class=""></div>
<div style="font-family: Helvetica; font-size: 12px; 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;" class="">Jordan</div>
<br class="" style="font-family: Helvetica; font-size: 12px; 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;">

<span style="font-family: Helvetica; font-size: 12px; 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><br style="font-family: Helvetica; font-size: 12px; 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;" class="">
<span style="font-family: Helvetica; font-size: 12px; 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="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; 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;" class="">
<a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; 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; font-size: 12px; 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;" class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; 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></div>
</blockquote>
</div>
<br class=""></div>
</div>
</div>
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div>
</blockquote>
</div>
<br class="">


_______________________________________________<br>swift-evolution mailing list<br>swift-evolution@swift.org<br>https://lists.swift.org/mailman/listinfo/swift-evolution<br></div></div></span></blockquote></div><div class="bloop_markdown"><p></p></div></body></html>