<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>Hi Tyler,</p>
<p>You’re a bit late indeed. The proposal got accepted with some modifications.</p>
<ol>
<li>No single line expression (for now).</li>
<li>The last string content line does not add an implicit new line to the resulting string.</li>
<li>Text is always in lines (content lines) between the delimiter lines, but never directly after or before the delimiters.</li>
<li>The indent and stripping is solved by calculating the indent prefix for the closing delimiter, mismatch in content lines results in an error.</li>
<li>Trailing backslash is not included and can be proposed as an additional feature later.</li>
<li>It’s not yet clear if the final version will warn about trailing whitespaces (I’d prefer that). Otherwise the following example could have 1000 characters and no one will ever guess it correctly.</li>
</ol>
<pre><code class="swift">"""
Foo<space><space>…<space>
"""
</code></pre>
<p>That last issue can be solved nicely by a trailing backslash as well, because it makes the trailing whitespace boundary visible like the closing delimiter makes it visible for leading whitespaces. And at the same time it would allow us to escape the new line injection when it’s desired.</p>
<hr>
<p>The concatenation is a no go for my issue. I always used small strings to showcase the problem, but in reality the string I was speaking about could be very long similar to this example: https://gist.github.com/DevAndArtist/345ce0920de62349c1079e18201aea94</p>
<p>That’s why I pursue the addition of the trailing backslash. </p>
<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_1492768044168826112" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div> <br><p class="airmail_on">Am 21. April 2017 um 11:17:19, Tyler Cloutier (<a href="mailto:cloutiertyler@aol.com">cloutiertyler@aol.com</a>) schrieb:</p> <blockquote type="cite" class="clean_bq"><span><div dir="auto"><div></div><div>
<title></title>
<div style="direction: inherit;">I am very much a fan of this type
of thing.</div>
<div style="direction: inherit;"><br></div>
<div style="direction: inherit;">It's very clear that new line are
included in the string. Leading white space is explicit. It is easy
to align. It's easy to copy and paste. And there isn't excessive
escaping.</div>
<div><br>
On Apr 3, 2017, at 7:00 AM, Ricardo Parada via swift-evolution
<<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>
wrote:<br>
<br></div>
<blockquote type="cite">
<div>
What is the purpose of that backslash?
It does not feel like an improvement.
<div class=""><br class=""></div>
<div class="">
<div class="">I think we should focus on:</div>
<div class=""><br class=""></div>
<div class="">1. Looking pretty</div>
<div class="">2. Allow unescaped quote, double quote as well
single/double apostrophe characters </div>
<div class="">3. Allow interpolation </div>
<div class="">4. No need to add the \n character for each
line</div>
<div class="">5. It should have a continuation character</div>
<div class="">6. Keep it simple</div>
<div class=""><br class=""></div>
<div class="">Something like this:</div>
<div class=""><br class=""></div>
<div class="">
<pre class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 0px; margin-bottom: 16px; line-height: 1.45; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal;"><code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; padding: 0px; margin: 0px; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal; border: 0px; display: inline; line-height: inherit; word-wrap: normal;">let xml = M"<?xml version="1.0"?>
"<catalog>
" <book id="bk101" empty="">
" <author><font color="#FF2600" class="">\(</font><font color="#0433FF" class="">author</font><font color="#FF2600" class="">)</font></author>
" </book>
"</catalog></code></pre>
<div class="">Or maybe this:</div>
<div class=""><br class=""></div>
<div class="">
<pre class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; margin-top: 0px; margin-bottom: 16px; line-height: 1.45; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal;"><code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; padding: 0px; margin: 0px; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal; border: 0px; display: inline; line-height: inherit; word-wrap: normal;">let xml = """<?xml version="1.0"?>
"<catalog>
" <book id="bk101" empty="">
" <author><font color="#FF2600" class="">\(</font><font color="#0433FF" class="">author</font><font color="#FF2600" class="">)</font></author>
" </book>
"</catalog></code></pre>
<div class="">In the first example the multiline literal is started
with M". In the second example it starts with three double
quotes """. I really have no preference. In both
examples there is no need to have a \ or \n at the end of the
line.</div>
<div class=""><br class=""></div>
<div class="">You can have quote characters in the string,
including double quotes as shown by <font face="Menlo" class="">empty=""</font>. You can have interpolation,
i.e. <font color="#FF2600" class="" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;">\(</font><font color="#0433FF" class="" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;">author</font><font color="#FF2600" class="" style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;">)</font>. </div>
<div class=""><br class=""></div>
<div class="">You have a continuation character which helps as a
visual guide and as a marker for the beginning of each line.</div>
</div>
<div class=""><br class=""></div>
<div class="">The multi string literal ends when there are no more
continuation characters.</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
</div>
<div>
<blockquote type="cite" class="">
<div class="">On Apr 3, 2017, at 3:01 AM, Adrian Zubarev via
swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</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="">
Hello Swift community,</p>
<p style="margin: 15px 0px;" class="">on Github there is a PR for
this proposal, but I couldn’t find any up to date thread, so I’m
going to start by replying to the last message I found, without the
last content.</p>
<p style="margin: 15px 0px;" class="">I really like where this
proposal is going, and my personal preference are *continuation
quotes*. However the proposed solution is still not perfect enough
for me, because it still lacks of precise control about the
trailing space characters in each line of a multi-line string.</p>
<p style="margin: 15px 0px;" class="">Proposed version looks 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 xml = "<?xml version=\"1.0\"?>
"<catalog>
" <book id=\"bk101\" empty=\"\">
" <author>\(author)</author>
" <title>XML Developer's Guide</title>
" <genre>Computer</genre>
" <price>44.95</price>
" <publish_date>2000-10-01</publish_date>
" <description>An in-depth look at creating applications with XML.</description>
" </book>
"</catalog>
""
</code></pre>
<p style="margin: 15px 0px;" class="">I would like to pitch an
enhancement to fix the last tiny part by adding the escaping
character ‘' to the end of each line from 1 to (n - 1) of the
n-lined string. This is similar to what Javascript allows us to do,
except that we also have precise control about the leading space
character through ’"’.</p>
<p style="margin: 15px 0px;" class="">The proposed version will
become 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 xml = "<?xml version=\"1.0\"?>\
"<catalog>\ // If you need you can comment here
" <book id=\"bk101\" empty=\"\">\
" <author>\(author)</author>\
" <title>XML Developer's Guide</title>\
" <genre>Computer</genre>\
" <price>44.95</price>\
" <publish_date>2000-10-01</publish_date>\
" <description>An in-depth look at creating applications with XML.</description>\
" </book>\
"</catalog>\
""
</code></pre>
<p style="margin: 15px 0px;" class="">Here is another example:</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 multilineString: String = "123__456__\ // indicates there is another part of the string on the next line
"__789_____\ // aways starts with `"` and ends with either `\` or `"`
"_____0_" // precise control about pre- and post-space-characters
let otherString = "\(someInstance)\ /* only comments are allowed in between */ "text \(someOtherInstance) text"
</code></pre>
<p style="margin: 15px 0px;" class="">This is simply<span class="Apple-converted-space"> </span><strong style="-webkit-margin-before: 0px;" class="">continuation
quotes</strong><span class="Apple-converted-space"> </span>combined with<span class="Apple-converted-space"> </span><strong class="">backslash
concatenation</strong>.</p>
<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 class="bloop_markdown">
<div style="margin: 15px 0px; -webkit-margin-before: 0px;" class=""><br class="webkit-block-placeholder"></div>
</div>
<div class="bloop_original_html">
<div id="bloop_customfont" style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px;" class=""><br class=""></div>
<br class="">
<div id="bloop_sign_1491202043170386944" class="bloop_sign">
<div style="font-family: helvetica, arial; font-size: 13px;" class="">-- <br class="">
Adrian Zubarev<br class="">
Sent with Airmail</div>
</div>
</div>
<div class="bloop_markdown">
<div style="margin: 15px 0px; -webkit-margin-before: 0px;" class=""><br class="webkit-block-placeholder"></div>
</div>
</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">
<div>
<span>_______________________________________________</span><br>
<span>swift-evolution mailing list</span><br>
<span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br>
<span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br>
</div>
</blockquote>
</div></div></span></blockquote></div><div class="bloop_markdown"><p></p></div></body></html>