<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="">I agree, but unfortunately it’s probably too late now.<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 19, 2017, at 3:11 PM, Martin Waitz 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=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div 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 <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=""> """</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=""> 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=""> """</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=""> +</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=""> """</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=""> 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=""> """</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=""> ==</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=""> """</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=""> 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=""> 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=""> """</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="">— </div><div class="">Martin</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">Am 19.04.2017 um 23:51 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="">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"> </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="">-- <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="">> Proposal Link:<span class="Apple-converted-space"> </span><br class="">> <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="">><span class="Apple-converted-space"> </span><br class="">> Hello Swift Community,<br class="">><span class="Apple-converted-space"> </span><br class="">> The review of SE-0168: "Multi-Line String Literals" ran from April 6...12, 2017. The<span class="Apple-converted-space"> </span><br class="">> proposal is *accepted with revisions. *Community feedback was largely positive on the<span class="Apple-converted-space"> </span><br class="">> idea, though the discussion highlighted several under-specified aspects.<br class="">><span class="Apple-converted-space"> </span><br class="">> - Questions arose about whether text could appear on the same line as the opening and<span class="Apple-converted-space"> </span><br class="">> closing delimiter, and how that would interact with the de-indentation algorithm. The<span class="Apple-converted-space"> </span><br class="">> core team feels that it is important to keep this feature focused on its purpose of<span class="Apple-converted-space"> </span><br class="">> allowing the easy embedding of pasted blocks of text, so *text inside the literal on<span class="Apple-converted-space"> </span><br class="">> the same line as either delimiter should be disallowed.*<br class="">><span class="Apple-converted-space"> </span><br class="">> // Allowed, equal to "foo\nbar"<br class="">> """<br class="">> foo<br class="">> bar<br class="">> """<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"> </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"> </span><br class="">line(not for the """ delimiter).<br class=""><br class="">><span class="Apple-converted-space"> </span><br class="">> // Not allowed<br class="">> """foo<br class="">> bar<br class="">> """<br class="">><span class="Apple-converted-space"> </span><br class="">> // Not allowed<br class="">> """<br class="">> foo<br class="">> bar"""<br class="">><span class="Apple-converted-space"> </span><br class="">> This keeps the model straightforward to describe: a *single newline *is always<span class="Apple-converted-space"> </span><br class="">> stripped after the opening delimiter and before the closing one, and the closing<span class="Apple-converted-space"> </span><br class="">> delimiter's position always determines the indentation level of the entire literal.<span class="Apple-converted-space"> </span><br class="">> The core team acknowledges that single-line triple quoted strings have other uses in<span class="Apple-converted-space"> </span><br class="">> other languages, such as to avoid excessive escaping in a string that contains lots<span class="Apple-converted-space"> </span><br class="">> of literal quotes, but supporting that alongside the indentation-stripping behavior<span class="Apple-converted-space"> </span><br class="">> leads to a lot of subtlety, and there could be other solutions to the escaping<span class="Apple-converted-space"> </span><br class="">> problem down the line, such as raw strings. If nothing else, single-line triple<span class="Apple-converted-space"> </span><br class="">> quoted strings can be considered later as an additive feature.<br class="">><span class="Apple-converted-space"> </span><br class="">> - The core team also believes that *underindentation or inconsistent tab/space usage<span class="Apple-converted-space"> </span><br class="">> within the indentation should be an error.* Every line inside the literal must begin<span class="Apple-converted-space"> </span><br class="">> with the exact sequence of spaces and tabs that precedes the closing delimiter.<br class="">><span class="Apple-converted-space"> </span><br class="">> """<br class="">> <tab><space>this is OK<br class="">> <space><space>this is an error<br class="">> <space><tab>this is also an error<br class="">> <tab>under-indenting is an error too<br class="">> <tab><space><space>but you can go nuts after the indentation all you want<br class="">> <tab><space><tab>you do you<br class="">> <tab><space>"""<br class="">><span class="Apple-converted-space"> </span><br class="">> - The quoted string should *normalize newlines* to \n in the value of the literal,<span class="Apple-converted-space"> </span><br class="">> regardless of whether the source file uses \n (Unix), \r\n (Windows), or \r (classic<span class="Apple-converted-space"> </span><br class="">> Mac) line endings. Likewise, when the compiler strips the initial and final newline<span class="Apple-converted-space"> </span><br class="">> from the literal value, it will strip one of any of the \n, \r\n, or \r line-ending<span class="Apple-converted-space"> </span><br class="">> sequences from both ends of the literal.<br class="">><span class="Apple-converted-space"> </span><br class="">> // equal to "foo\nfoo\nfoo\nfoo"<br class="">> """^J<br class="">> foo^M^J<br class="">> foo^J<br class="">> foo^M<br class="">> foo^M<br class="">> """<br class="">><span class="Apple-converted-space"> </span><br class="">> - It should be clarified that *multiline strings support the same escapes and<span class="Apple-converted-space"> </span><br class="">> interpolations* as single-line strings. This allows a literal """ to be written \""".<span class="Apple-converted-space"> </span><br class="">> Discussion on the list raised the idea of allowing a line to end with \ to "escape"<span class="Apple-converted-space"> </span><br class="">> the newline and elide it from the value of the literal; the core team had concerns<span class="Apple-converted-space"> </span><br class="">> about only allowing that inside multi-line literals and felt that that could also be<span class="Apple-converted-space"> </span><br class="">> considered later as an additive feature.<br class="">><span class="Apple-converted-space"> </span><br class="">> Thanks John, Brent, and Tyler for the original proposal, and thanks to everyone who<span class="Apple-converted-space"> </span><br class="">> participated in the discussion!<br class="">><span class="Apple-converted-space"> </span><br class="">> -Joe<br class="">> Review Manager<br class="">><span class="Apple-converted-space"> </span><br class="">><span class="Apple-converted-space"> </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="">> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">><span class="Apple-converted-space"> </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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><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=""></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=""></div></body></html>