<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>Two things:</p>
<ol>
<li><p>Shall we rename the thread for to focus onto the new topic?</p></li>
<li><p>The toolchain is great, the multi-line string literal how I imagined it to be the whole time, except for two smaller issues.</p></li>
</ol>
<p>The the fix-it is wrong for the following two examples:</p>
<pre><code class="swift">"""
123<space>
"""
"""
abc
123<space>
"""
</code></pre>
<p>It will ask you to add <code>\n\</code> for for the line behind the closing delimiter it only should be <code>\</code>. But a warning in such a case is the perfect direction for the whole debate we’re having in this thread.</p>
<p>The second issue is only out of my curiosity. </p>
<pre><code class="swift">"""
Foo\<space><new_line_character>
"""
</code></pre>
<p>This results in an error right now. Is it possible to teach the compiler to swallow whitespace characters after the backslash until a new line character is found, simply said to ignore them, because in that case they are irrelevant and not harmful.</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_1492956751355661824" 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 23. April 2017 um 13:30:34, John Holdsworth via swift-evolution (<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>) schrieb:</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="">Following this thread it reads to me that SE-0168
being accepted without newline escapes was</div>
<div class="">regrettable as it gave us more flexibility in
formatting “long strings”.</div>
<div class=""><br class=""></div>
<div class="">As the core team rejected it on the basis that it was
inconsistent with conventional string literals the </div>
<div class="">obvious thing to do is raise a short micro-proposal
that newline escape be introduced into both. This </div>
<div class="">would also bring them into line with C literals. I’ve
drafted a new proposal we could discuss and which</div>
<div class="">I hope to submit tomorrow as the implementation is
trivial if it’s not too late:</div>
<div class=""><br class=""></div>
<div class=""><a href="https://github.com/johnno1962c/swift-evolution/blob/master/proposals/0173-newline-escape-in-strings.md" class="">https://github.com/johnno1962c/swift-evolution/blob/master/proposals/0173-newline-escape-in-strings.md</a></div>
<div class=""><br class=""></div>
<div class="">For me personally, this would also have the happy
side effect of making it possible to reopen the debate</div>
<div class="">about "should the final newline be stripped by
default" as it could now so easily be escaped for those who</div>
<div class="">like their multiline literals missing a newline on
the last line :)</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<div class="">I’ve updated the prototype toolchain to bring it into
line with the Core team's decision available here:</div>
<div class=""><br class=""></div>
<div class=""><a href="http://johnholdsworth.com/swift-LOCAL-2017-04-22-a-osx.tar.gz" class="">http://johnholdsworth.com/swift-LOCAL-2017-04-22-a-osx.tar.gz</a></div>
<div class=""><br class=""></div>
<div class="">(This includes newline escaping on all strings but
dutifully strips the last line)</div>
<div class=""><br class=""></div>
<div class="">As it looks like this patch might form the basis of
the implementation in Swift 4, all testing appreciated.</div>
<div class=""><br class=""></div>
<div class=""><a href="https://github.com/apple/swift/pull/8813" class="">https://github.com/apple/swift/pull/8813</a></div>
<div class=""><br class=""></div>
<div class="">-John</div>
<div class=""><br class=""></div>
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 23 Apr 2017, at 10:41, Xiaodi Wu 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="">Sure, I can give an example. I'm not going to suggest
that it'd win any awards, but:<br class="">
<br class="">
By restricting multiline literals to begin and end on distinct
lines, the core team has established an interesting property.
Namely, "literals" are delimited horizontally while """literals"""
are delimited vertically.<br class="">
<br class="">
To enable hard wrapping, permit continuation of literals by
apposition of consecutive literals. That is, "Hello, " "world!"
would be equivalent to "Hello, world!". This single rule can be
applied to either kind of string literal. That is:<br class="">
<br class="">
let a =<br class="">
"Hello, "<br class="">
"world!"<br class="">
<br class="">
let b =<br class="">
"""<br class="">
Hello,<br class="">
""" """<br class="">
world!<br class="">
"""<br class="">
<br class="">
a == b // true<br class="">
<br class="">
It certainly permits elided newlines. It is the exact same rule
applied to both types of literals. It preserves code indentation
and does not require single-line string literals to support code
stripping. I leave it to your judgement whether it works "equally
well" and/or is "horrible."<br class="">
<div class="gmail_quote">
<div dir="ltr" class="">On Sun, Apr 23, 2017 at 04:13 Brent
Royal-Gordon <<a href="mailto:brent@architechies.com" class="">brent@architechies.com</a>> wrote:<br class=""></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On Apr 22, 2017, at 8:12 AM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>> wrote:</div>
<br class="m_-1748841490727356249Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">On Sat, Apr 22, 2017 at 3:38 AM, Brent
Royal-Gordon <span dir="ltr" class=""><<a href="mailto:brent@architechies.com" target="_blank" class="">brent@architechies.com</a>></span> wrote:<br class="">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">
<div class="">
<blockquote type="cite" class="">
<div class=""><span class="">On Apr 21, 2017, at 11:48 AM, Xiaodi
Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</span></div>
<span class=""><br class="m_-1748841490727356249m_-9186835439891025487Apple-interchange-newline">
</span>
<div class=""><span 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;float:none;display:inline!important" class="">This goes to my question to David Hart. Isn't this an
argument for a feature to allow breaking a single-line string
literal across multiple lines? What makes this a use case for
some feature for _multiline_ string literals in
particular?</span></span></div>
</blockquote>
<br class=""></div>
<div class="">Well, if you're breaking a string across several
lines, you will want indentation stripping too. Are you suggesting
we should also bring that feature to single-line string literals
with escaped newlines?</div>
</div>
</blockquote>
<div class=""><br class=""></div>
<div class="">No, I am suggesting that whatever design is used for
escaped newlines, if at all possible it should be equally apt for
"strings" and """strings""" such that it will not require
indentation stripping.</div>
</div>
</div>
</div>
</div>
</blockquote>
<br class=""></div>
</div>
<div style="word-wrap:break-word" class="">
<div class="">Could you share an example of such a design? It
doesn't have to be something you'd be happy to have in the
language; it just needs to fit the following criteria:</div>
<div class=""><br class=""></div>
<div class="">* Permits non-significant hard-wrapping in a string
literal.</div>
<div class=""><br class=""></div>
<div class="">* Works equally well with single and triple string
literals.</div>
<div class=""><br class=""></div>
<div class="">* Preserves code indentation, but does not require
single string literals to do indentation stripping.</div>
<div class=""><br class=""></div>
<div class="">* Is not horribly inconvenient.</div>
</div>
<div style="word-wrap:break-word" class=""><br class="">
<div class="">
<div class="">
<div style="font-size:12px" class=""><span class="m_-1748841490727356249Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-position: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
-- </span></div>
<div style="font-size:12px" class=""><span class="m_-1748841490727356249Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-position: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
Brent Royal-Gordon</span></div>
<div style="font-size:12px" class=""><span class="m_-1748841490727356249Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-position: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
Architechies</span></div>
</div>
</div>
<br class=""></div>
</blockquote>
</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>