<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=""><div class="">Hi,</div><div class=""><br class=""></div><div class="">I think, it would be more natural to include the last newline.</div><div class="">Multi-line String literals are for multiple lines.</div><div class="">And each line ends in a&nbsp;<span style="font-family: Menlo; background-color: rgb(255, 255, 255);" class="">\n</span><span style="background-color: rgb(255, 255, 255);" class="">. Otherwise it wouldn’t be a line.</span></div><div class=""><br class=""></div><div class="">Having</div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">&nbsp; &nbsp;&nbsp;"""</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; line 1</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; """</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; +</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; """</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; line 2</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; """</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; ==</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; """</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; line 1</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; line 2</span></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">&nbsp; &nbsp; """</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div class="">makes a lot of sense to me.</div><div class=""><br class=""></div><div class="">Or do we want to magically add a trailing newline everywhere as we do in print()?</div><div class="">Better change print to only add the newline when necessary! (e.g. by adding a new parameter which defaults to „auto“)</div><div class=""><br class=""></div><div class="">—&nbsp;</div><div class="">Martin</div><br class=""><div><blockquote type="cite" class=""><div class="">Am 19.04.2017 um 23:51 schrieb Adrian Zubarev via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt;:</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="">This is the natural way of text blocks. If you really need a blank line you can add one at the start/end or alternatively use<span class="Apple-converted-space">&nbsp;</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>.</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;">"""

Foo  

"""

// Equals "\nFoo\n"
</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_1492638545923299072" class="bloop_sign"><div style="font-family: helvetica, arial; font-size: 13px;" class="">--&nbsp;<br class="">Adrian Zubarev<br class="">Sent with Airmail</div></div><br class=""><p class="airmail_on" style="margin: 15px 0px;">Am 19. April 2017 um 22:53:07, Vladimir.S via swift-evolution (<a href="mailto:swift-evolution@swift.org" style="color: rgb(65, 131, 196); background-color: inherit; text-decoration: none;" class="">swift-evolution@swift.org</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=""></div><div class="">On 19.04.2017 23:03, Joe Groff via swift-evolution wrote:<br class="">&gt; Proposal Link:<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md</a><br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; Hello Swift Community,<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; The review of SE-0168: "Multi-Line String Literals" ran from April 6...12, 2017. The<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; proposal is *accepted with revisions. *Community feedback was largely positive on the<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; idea, though the discussion highlighted several under-specified aspects.<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; - Questions arose about whether text could appear on the same line as the opening and<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; closing delimiter, and how that would interact with the de-indentation algorithm. The<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; core team feels that it is important to keep this feature focused on its purpose of<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; allowing the easy embedding of pasted blocks of text, so *text inside the literal on<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; the same line as either delimiter should be disallowed.*<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; // Allowed, equal to "foo\nbar"<br class="">&gt; """<br class="">&gt; foo<br class="">&gt; bar<br class="">&gt; """<br class=""><br class="">Could you clarify, shouldn't this be equal to "foo\nbar\n" ? I.e. with trailing \n<span class="Apple-converted-space">&nbsp;</span><br class="">for "bar" line?<br class="">I didn't find any clarification about the injecting of line-end for last text<span class="Apple-converted-space">&nbsp;</span><br class="">line(not for the """ delimiter).<br class=""><br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; // Not allowed<br class="">&gt; """foo<br class="">&gt; bar<br class="">&gt; """<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; // Not allowed<br class="">&gt; """<br class="">&gt; foo<br class="">&gt; bar"""<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; This keeps the model straightforward to describe: a *single newline *is always<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; stripped after the opening delimiter and before the closing one, and the closing<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; delimiter's position always determines the indentation level of the entire literal.<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; The core team acknowledges that single-line triple quoted strings have other uses in<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; other languages, such as to avoid excessive escaping in a string that contains lots<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; of literal quotes, but supporting that alongside the indentation-stripping behavior<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; leads to a lot of subtlety, and there could be other solutions to the escaping<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; problem down the line, such as raw strings. If nothing else, single-line triple<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; quoted strings can be considered later as an additive feature.<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; - The core team also believes that *underindentation or inconsistent tab/space usage<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; within the indentation should be an error.* Every line inside the literal must begin<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; with the exact sequence of spaces and tabs that precedes the closing delimiter.<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; """<br class="">&gt; &lt;tab&gt;&lt;space&gt;this is OK<br class="">&gt; &lt;space&gt;&lt;space&gt;this is an error<br class="">&gt; &lt;space&gt;&lt;tab&gt;this is also an error<br class="">&gt; &lt;tab&gt;under-indenting is an error too<br class="">&gt; &lt;tab&gt;&lt;space&gt;&lt;space&gt;but you can go nuts after the indentation all you want<br class="">&gt; &lt;tab&gt;&lt;space&gt;&lt;tab&gt;you do you<br class="">&gt; &lt;tab&gt;&lt;space&gt;"""<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; - The quoted string should *normalize newlines* to \n in the value of the literal,<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; regardless of whether the source file uses \n (Unix), \r\n (Windows), or \r (classic<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; Mac) line endings. Likewise, when the compiler strips the initial and final newline<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; from the literal value, it will strip one of any of the \n, \r\n, or \r line-ending<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; sequences from both ends of the literal.<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; // equal to "foo\nfoo\nfoo\nfoo"<br class="">&gt; """^J<br class="">&gt; foo^M^J<br class="">&gt; foo^J<br class="">&gt; foo^M<br class="">&gt; foo^M<br class="">&gt; """<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; - It should be clarified that *multiline strings support the same escapes and<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; interpolations* as single-line strings. This allows a literal """ to be written \""".<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; Discussion on the list raised the idea of allowing a line to end with \ to "escape"<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; the newline and elide it from the value of the literal; the core team had concerns<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; about only allowing that inside multi-line literals and felt that that could also be<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; considered later as an additive feature.<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; Thanks John, Brent, and Tyler for the original proposal, and thanks to everyone who<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; participated in the discussion!<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; -Joe<br class="">&gt; Review Manager<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; _______________________________________________<br class="">&gt; swift-evolution mailing list<br class="">&gt; <a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">_______________________________________________<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></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=""></body></html>