<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>It was simply a pitch ;) Adding comments it’s not important to me, but I thought it could simply work after the backlash. </p>

<p>And multi-line comments <code>/**/</code> should work fine and are not ambiguous because they also have a clear single line purpose. Remember SE–0102 here <code>public /*closed*/ enum Never { /*no values*/ }</code>?</p>

<p>I wasn’t talking about escaping comments but allowing comments after the end of the current line of a multi-lined string which is explicitly annotated with a backslash.</p>

<p>If no one likes that pitch, fine I don’t I don’t want to pursue the idea then. ;) </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_1492006156100048896" 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">Am 12. April 2017 um 15:43:04, Thorsten Seitz 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>


<br class="">
<div>
<blockquote type="cite" class="">
<div class="">Am 12.04.2017 um 14:56 schrieb Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt;:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">Sure, but keep in mind you're ultimately presenting a
long string to the user. Chances are if it needs commenting to the
reader of the code, it needs commenting to the reader of the string
(which could be code itself, whether a SQL query or something
else).</div>
</div>
</blockquote>
<div><br class=""></div>
Good point.</div>
<div><br class=""></div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">
<div class="">Can you give a use case where essentially you need
two-tiered comments like this?</div>
</div>
</blockquote>
<div><br class=""></div>
<div>Nope, just thought that Adrian’s idea seemed useful and not
detrimental.</div>
<div><br class=""></div>
<div>Actually I’m fine with or without comments.</div>
<div><br class=""></div>
<div>-Thorsten</div>
<div class=""><br class=""></div>
<div class=""><br class=""></div>
<blockquote type="cite" class="">
<div class="">
<div class=""><br class=""></div>
<div class=""><br class="">
<div class="gmail_quote">
<div class="">On Wed, Apr 12, 2017 at 07:47 Thorsten Seitz via
swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; 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="gmail_msg">
<div class="gmail_msg">
<blockquote type="cite" class="gmail_msg">
<div class="gmail_msg">Am 12.04.2017 um 14:36 schrieb Ricardo
Parada via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt;:</div>
<br class="gmail_msg m_4946763772391147942Apple-interchange-newline">
<div class="gmail_msg">
<div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254)" class="gmail_msg">I don't think I would use that. I don't find the
aesthetics pleasant.&nbsp;<br class="gmail_msg">
I would rather comment above the string literal.&nbsp;</div>
</div>
</blockquote>
<div class="gmail_msg"><br class="gmail_msg"></div>
</div>
</div>
<div style="word-wrap:break-word" class="gmail_msg">
<div class="gmail_msg">It might be useful when many comments would
be required where putting them in a bunch above the literal would
make it difficult to properly correlate them with the respective
pieces of the string.</div>
<div class="gmail_msg"></div>
</div>
<div style="word-wrap:break-word" class="gmail_msg">
<div class="gmail_msg"><br class="gmail_msg">
<blockquote type="cite" class="gmail_msg">
<div class="gmail_msg">
<div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254)" class="gmail_msg"><br class="gmail_msg"></div>
<div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254)" class="gmail_msg">Would the escape character cause the newline for
the line to be ignored thereby continuing the string on the next
line?</div>
</div>
</blockquote>
<div class="gmail_msg"><br class="gmail_msg"></div>
</div>
</div>
<div style="word-wrap:break-word" class="gmail_msg">
<div class="gmail_msg">Yes. The semantics of the backslash should
not change, its presence just opens the room for placing a
comment.</div>
<div class="gmail_msg">To get a newline you would have to write
\n\</div>
<div class="gmail_msg"><br class="gmail_msg"></div>
<div class="gmail_msg">let myString = "““</div>
<div class="gmail_msg">&nbsp; &nbsp; text text\n\ // comment</div>
<div class="gmail_msg">&nbsp; &nbsp; text text</div>
<div class="gmail_msg">&nbsp; &nbsp; ““"</div>
</div>
<div style="word-wrap:break-word" class="gmail_msg">
<div class="gmail_msg"><br class="gmail_msg"></div>
<div class="gmail_msg">-Thorsten</div>
</div>
<div style="word-wrap:break-word" class="gmail_msg">
<div class="gmail_msg"><br class="gmail_msg">
<blockquote type="cite" class="gmail_msg">
<div class="gmail_msg">
<div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254)" class="gmail_msg"><br class="gmail_msg">
<br class="gmail_msg"></div>
<div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254)" class="gmail_msg"><br class="gmail_msg">
On Apr 12, 2017, at 6:59 AM, Adrian Zubarev via swift-evolution
&lt;<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt;
wrote:<br class="gmail_msg">
<br class="gmail_msg"></div>
<blockquote type="cite" style="margin:15px 0px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254)" class="gmail_msg">
<div style="margin-top:0px;margin-bottom:0px" class="gmail_msg">
<div class="gmail_msg m_4946763772391147942bloop_markdown">
<p style="margin:15px 0px" class="gmail_msg">One last pitch, can we
allow comments in multi-line strings if the string is broken up by
a backslash?</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="gmail_msg"><code class="gmail_msg m_4946763772391147942swift" 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">
let myString = """
    text text   
    text text text \ // Comment allowed in the current line here, but not in the line above it
    text text text \ /* this type of comment is fine too */
    text text\// notice whitespace can be ignored
    """
</code></pre>
<p style="margin:15px 0px" class="gmail_msg">You might have some
interpolation and want to comment around it.</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="gmail_msg"><code class="gmail_msg m_4946763772391147942swift" 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">let foo = """
    bar bar bar
    bar \(x) bar\ // `x` does some magic
    """
</code></pre>
<div style="margin:15px 0px" class="gmail_msg"><br class="m_4946763772391147942webkit-block-placeholder gmail_msg"></div>
</div>
<div class="gmail_msg m_4946763772391147942bloop_original_html">
<div id="m_4946763772391147942bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;margin:0px" class="gmail_msg"><br class="gmail_msg"></div>
<br class="gmail_msg">
<div id="m_4946763772391147942bloop_sign_1491994413280799744" class="gmail_msg m_4946763772391147942bloop_sign">
<div style="font-family:helvetica,arial;font-size:13px" class="gmail_msg">--&nbsp;<br class="gmail_msg">
Adrian Zubarev<br class="gmail_msg">
Sent with Airmail</div>
</div>
<br class="gmail_msg">
<p class="m_4946763772391147942airmail_on gmail_msg" style="margin:15px 0px">Am 12. April 2017 um 12:48:57, Adrian Zubarev
(<a href="mailto:adrian.zubarev@devandartist.com" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">adrian.zubarev@devandartist.com</a>) schrieb:</p>
<blockquote type="cite" class="m_4946763772391147942clean_bq gmail_msg" style="margin:15px 0px">
<div style="word-wrap:break-word" class="gmail_msg">
<div class="gmail_msg"></div>
<div class="gmail_msg">
<div class="gmail_msg m_4946763772391147942bloop_markdown">
<p style="margin:15px 0px" class="gmail_msg"><span style="margin-top:0px;margin-bottom:0px" class="gmail_msg">Actually I’m
fine with such a compromise. Such a model has everything we’ve
asked for, it’s easy, it has both leading and trailing precision
and implicit new lines where needed.</span></p>
</div>
<div class="gmail_msg m_4946763772391147942bloop_original_html">
<div id="m_4946763772391147942bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;margin:0px" class="gmail_msg"><span style="margin-top:0px;margin-bottom:0px" class="gmail_msg"><br class="gmail_msg"></span></div>
<span style="margin-top:0px;margin-bottom:0px" class="gmail_msg"><br class="gmail_msg"></span>
<div id="m_4946763772391147942bloop_sign_1491994049751838976" class="gmail_msg m_4946763772391147942bloop_sign">
<div style="font-family:helvetica,arial;font-size:13px" class="gmail_msg"><span style="margin-top:0px;margin-bottom:0px" class="gmail_msg">--&nbsp;<br class="gmail_msg">
Adrian Zubarev<br class="gmail_msg">
Sent with Airmail</span></div>
</div>
<span style="margin-top:0px;margin-bottom:0px" class="gmail_msg"><br class="gmail_msg"></span>
<p class="m_4946763772391147942airmail_on gmail_msg" style="margin:15px 0px"><span style="margin-top:0px;margin-bottom:0px" class="gmail_msg">Am 12. April 2017 um 12:42:17, 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="gmail_msg" target="_blank">swift-evolution@swift.org</a>)
schrieb:</span></p>
<blockquote type="cite" class="m_4946763772391147942clean_bq gmail_msg" style="margin:15px 0px">
<div style="margin-top:0px;margin-bottom:0px" class="gmail_msg">
<div class="gmail_msg"><span style="margin-top:0px;margin-bottom:0px" class="gmail_msg"><span class="gmail_msg">On 12.04.2017 13:16, Thorsten Seitz via swift-evolution
wrote:<br class="gmail_msg">
&gt;&gt; Am 12.04.2017 um 10:11 schrieb Adrian Zubarev via
swift-evolution<br class="gmail_msg">
&gt;&gt; &lt;<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><span class="gmail_msg m_4946763772391147942Apple-converted-space">&nbsp;</span>&lt;<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt;:<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; Great explanation thank you Brent. I’m convinced about the
closing delimiter now. =)<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt;
-------------------------------------------------------------------------------------<br class="gmail_msg">

&gt;&gt;<br class="gmail_msg">
&gt;&gt; If I understood correctly what Xiaodi Wu meant in his
reply, then we could simplify<br class="gmail_msg">
&gt;&gt; the whole multi-line string literal and also remove the
need of disabling the<br class="gmail_msg">
&gt;&gt; stripping algorithm.<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; We should ban these examples completely:<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; |"""Hello·world!"""|<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; Being able to use ""“ for single line strings containing lots
of " is useful in<br class="gmail_msg">
&gt; itself and explained in the motivational section of the
proposal:<br class="gmail_msg">
&gt; "Tripled string literals can also do double duty as a syntax
for handling short<br class="gmail_msg">
&gt; string literals with many internal quotation marks“<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; -Thorsten<br class="gmail_msg">
<br class="gmail_msg">
Yes, I also think the single line string can be very useful and we
should not<br class="gmail_msg">
disallow it.<br class="gmail_msg">
<br class="gmail_msg">
But I agree that we should disallow multi-line cases when we have
text on the same<br class="gmail_msg">
line with leading or trailing """ because this complicates the
mental modal and adds<br class="gmail_msg">
confusion points.<br class="gmail_msg">
<br class="gmail_msg">
I.e. I suggest to allow only two forms:<br class="gmail_msg">
1. Single line: """this is "just" text""" (no line end will be
inserted)<br class="gmail_msg">
2. Multiline, where leading and trailing """ has no text
after/before them and *all*<br class="gmail_msg">
the text is in lines *between* triple quotes:<br class="gmail_msg">
"""<br class="gmail_msg">
first line<br class="gmail_msg">
second line<br class="gmail_msg">
"""<br class="gmail_msg">
<br class="gmail_msg">
One can use backslash at the line end to emulate all other needed
cases. Like:<br class="gmail_msg">
<br class="gmail_msg">
"""<br class="gmail_msg">
first line \<br class="gmail_msg">
second line\<br class="gmail_msg">
"""<br class="gmail_msg">
<br class="gmail_msg">
will produce "first line second line"<br class="gmail_msg">
<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt;&gt; |"""Hello↵ world!""" |<br class="gmail_msg">
&gt;&gt; |"""Hello↵ world!↵ """ |<br class="gmail_msg">
&gt;&gt; |"""↵ Hello↵ world!""" |<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; Instead an empty multi-line string literal would look like
this:<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; |"""↵ """ |<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; To fix the above example you’d need to write it like
this:<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; |"""↵ Hello·world!\↵ """ |<br class="gmail_msg">
&gt;&gt; |"""↵ Hello↵ world!\↵ """ |<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; * Each line in between the delimiters would add implicit
new lines if not<br class="gmail_msg">
&gt;&gt; disabled by a backslash.<br class="gmail_msg">
&gt;&gt; * The trailing precision is also handled by the
backslash.<br class="gmail_msg">
&gt;&gt; * The indent is handled by the closing
delimiter.<br class="gmail_msg">
&gt;&gt; * It’s easier to learn/teach.<br class="gmail_msg">
&gt;&gt; * It’s easier to read, because most of the time the line
where the starting<br class="gmail_msg">
&gt;&gt; delimiter is, is filled with some other code.<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; |let myString = """↵ ⇥ ⇥ Hello↵ ⇥ ⇥ world!\↵ ⇥ ⇥ """
|<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; Now that would be a true multi-line string literal which
needs at least two lines<br class="gmail_msg">
&gt;&gt; of code. If you’d need a single line literal,|""|is the
obvious pick.<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; --<br class="gmail_msg">
&gt;&gt; Adrian Zubarev<br class="gmail_msg">
&gt;&gt; Sent with Airmail<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; Am 12. April 2017 um 02:32:33, Brent Royal-Gordon
(<a href="mailto:brent@architechies.com" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">brent@architechies.com</a><br class="gmail_msg">
&gt;&gt; &lt;<a href="mailto:brent@architechies.com" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">mailto:brent@architechies.com</a>&gt;) schrieb:<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; On Apr 11, 2017, at 8:08 AM, Adrian Zubarev via
swift-evolution<br class="gmail_msg">
&gt;&gt;&gt;&gt; &lt;<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><span class="gmail_msg m_4946763772391147942Apple-converted-space">&nbsp;</span>&lt;<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">mailto:swift-evolution@swift.org</a>&gt;&gt;
wrote:<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; That’s also the example that kept me thinking for
a while.<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt;
-------------------------------------------------------------------------------------<br class="gmail_msg">

&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; Overall the proposal is a great compromise to some
issues I had with the first<br class="gmail_msg">
&gt;&gt;&gt;&gt; version. However I have a few more
questions:<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; * Why can’t we make it consistent and let the
compiler add a new line after the<br class="gmail_msg">
&gt;&gt;&gt;&gt; starting delimiter.<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; |<br class="">
let string = """↵ Swift↵ """ // result ↵Swift↵ |<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; If one would would the behavior from the proposal
it’s really easy to add a<br class="gmail_msg">
&gt;&gt;&gt;&gt; backslash after the starting delimiter.<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; |<br class="">
let string = """\↵ Swift\↵ """ // result Swift |<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; This would be consistent and less confusing to
learn.<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; That would mean that code like this:<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; print("""<br class="gmail_msg">
&gt;&gt;&gt; A whole bunch of<br class="gmail_msg">
&gt;&gt;&gt; multiline text<br class="gmail_msg">
&gt;&gt;&gt; """)<br class="gmail_msg">
&gt;&gt;&gt; print("""<br class="gmail_msg">
&gt;&gt;&gt; A whole bunch more<br class="gmail_msg">
&gt;&gt;&gt; multiline text<br class="gmail_msg">
&gt;&gt;&gt; """)<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; Will print (with - to indicate blank lines):<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; -<br class="gmail_msg">
&gt;&gt;&gt; A whole bunch of<br class="gmail_msg">
&gt;&gt;&gt; multiline text<br class="gmail_msg">
&gt;&gt;&gt; -<br class="gmail_msg">
&gt;&gt;&gt; -<br class="gmail_msg">
&gt;&gt;&gt; A whole bunch more<br class="gmail_msg">
&gt;&gt;&gt; multiline text<br class="gmail_msg">
&gt;&gt;&gt; -<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; This is, to a first approximation, never what you
actually want the computer to do.<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; * Can’t we make the indent algorithm work like
this instead?<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; |let string = """\↵ ····&lt;tag&gt;↵ ······content
text↵ ····&lt;/tag&gt;""" // Indent starts<br class="gmail_msg">
&gt;&gt;&gt;&gt; with the first non space character // result
&lt;tag&gt;↵ ··content text↵ &lt;/tag&gt; |<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; The line where the closing delimiter is trims all
space chapters and the indent<br class="gmail_msg">
&gt;&gt;&gt;&gt; for the whole multi-line string is starting at the
point where the first<br class="gmail_msg">
&gt;&gt;&gt;&gt; non-space chapters is in that line.<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; We could; I discuss that briefly in the very last
section, on alternatives to the<br class="gmail_msg">
&gt;&gt;&gt; indentation stripping we specify:<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; • Stripping indentation to match the depth of the
least indented line: Instead of<br class="gmail_msg">
&gt;&gt;&gt; removing indentation to match the end delimiter, you
remove indentation to match<br class="gmail_msg">
&gt;&gt;&gt; the least indented line of the string itself. The
issue here is that, if all lines<br class="gmail_msg">
&gt;&gt;&gt; in a string should be indented, you can't use
indentation stripping. Ruby 2.3 does<br class="gmail_msg">
&gt;&gt;&gt; this with its heredocs, and Python's dedent function
also implements this behavior.<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; That doesn't quite capture the entire breadth of the
problem with this algorithm,<br class="gmail_msg">
&gt;&gt;&gt; though. What you'd like to do is say, "all of these
lines are indented four<br class="gmail_msg">
&gt;&gt;&gt; columns, so we should remove four columns of
indentation from each line". But you<br class="gmail_msg">
&gt;&gt;&gt; don't have columns; you have tabs and spaces, and
they're incomparable because the<br class="gmail_msg">
&gt;&gt;&gt; compiler can't know what tab stops you set. So we'd
end up calculating a common<br class="gmail_msg">
&gt;&gt;&gt; prefix of whitespace for all lines and removing that.
But that means, when someone<br class="gmail_msg">
&gt;&gt;&gt; mixes tabs and spaces accidentally, you end up
stripping an amount of indentation<br class="gmail_msg">
&gt;&gt;&gt; that is unrelated to anything visible in your code. We
could perhaps emit a<br class="gmail_msg">
&gt;&gt;&gt; warning in some suspicious circumstances (like "every
line has whitespace just<br class="gmail_msg">
&gt;&gt;&gt; past the end of indentation, but some use tabs and
others use spaces"), but if we<br class="gmail_msg">
&gt;&gt;&gt; do, we can't know which one is supposed to be correct.
With the proposed design,<br class="gmail_msg">
&gt;&gt;&gt; we know what's correct—the last line—and any deviation
from it can be flagged *at<br class="gmail_msg">
&gt;&gt;&gt; the particular line which doesn't match our
expectation*.<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; Even without the tabs and spaces issue, consider the
case where you accidentally<br class="gmail_msg">
&gt;&gt;&gt; don't indent a line far enough. With your algorithm,
that's indistinguishable from<br class="gmail_msg">
&gt;&gt;&gt; wanting the other lines to be indented more than that
one, so we generate a result<br class="gmail_msg">
&gt;&gt;&gt; you don't want and we don't (can't!) emit a warning to
point out the mistake. With<br class="gmail_msg">
&gt;&gt;&gt; the proposed algorithm, we can notice there's an error
and point to the line at fault.<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; Having the closing delimiter always be on its own line
and using it to decide how<br class="gmail_msg">
&gt;&gt;&gt; much whitespace to strip is better because it gives
the compiler a firm baseline<br class="gmail_msg">
&gt;&gt;&gt; to work from. That means it can tell you what's wrong
and where, instead of doing<br class="gmail_msg">
&gt;&gt;&gt; the dumb computer thing and computing a result that's
technically correct but useless.<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt;&gt; PS: If we’d get this feature in Swift, it would be
nice if Xcode and other IDEs<br class="gmail_msg">
&gt;&gt;&gt;&gt; which supports Swift could show space characters
that are inside a string literal<br class="gmail_msg">
&gt;&gt;&gt;&gt; (not other space character &lt;- which is already
supported), so it would be easier<br class="gmail_msg">
&gt;&gt;&gt;&gt; to tell what’s part of the string and what is
not.<br class="gmail_msg">
&gt;&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; That would be very nice indeed. The prototype's
tokenizer simply concatenates<br class="gmail_msg">
&gt;&gt;&gt; together and computes the string literal's contents
after whitespace stripping,<br class="gmail_msg">
&gt;&gt;&gt; but in principle, I think it could probably preserve
enough information to tell<br class="gmail_msg">
&gt;&gt;&gt; SourceKit where the indentation ends and the literal
content begins. (The<br class="gmail_msg">
&gt;&gt;&gt; prototype is John's department, though, not mine.)
Xcode would then have to do<br class="gmail_msg">
&gt;&gt;&gt; something with that information, though, and
swift-evolution can't make the Xcode<br class="gmail_msg">
&gt;&gt;&gt; team do so. But I'd love to see a faint reddish
background behind tripled string<br class="gmail_msg">
&gt;&gt;&gt; literal content or a vertical line at the indentation
boundary.<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; In the meantime, this design *does* provide an
unambiguous indicator of how much<br class="gmail_msg">
&gt;&gt;&gt; whitespace will be trimmed: however much is to the
left of the closing delimiter.<br class="gmail_msg">
&gt;&gt;&gt; You just have to imagine the line extending upwards
from there. I think that's an<br class="gmail_msg">
&gt;&gt;&gt; important thing to have.<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;&gt; --<br class="gmail_msg">
&gt;&gt;&gt; Brent Royal-Gordon<br class="gmail_msg">
&gt;&gt;&gt; Architechies<br class="gmail_msg">
&gt;&gt;&gt;<br class="gmail_msg">
&gt;&gt;<br class="gmail_msg">
&gt;&gt; _______________________________________________<br class="gmail_msg">
&gt;&gt; swift-evolution mailing list<br class="gmail_msg">
&gt;&gt;<span class="gmail_msg m_4946763772391147942Apple-converted-space">&nbsp;</span><a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><span class="gmail_msg m_4946763772391147942Apple-converted-space">&nbsp;</span>&lt;<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">mailto:swift-evolution@swift.org</a>&gt;<br class="gmail_msg">
&gt;&gt;<span class="gmail_msg m_4946763772391147942Apple-converted-space">&nbsp;</span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">

&gt;<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt;<br class="gmail_msg">
&gt; _______________________________________________<br class="gmail_msg">
&gt; swift-evolution mailing list<br class="gmail_msg">
&gt;<span class="gmail_msg m_4946763772391147942Apple-converted-space">&nbsp;</span><a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
&gt;<span class="gmail_msg m_4946763772391147942Apple-converted-space">&nbsp;</span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">

&gt;<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</span></span></div>
</div>
</blockquote>
</div>
<div class="gmail_msg m_4946763772391147942bloop_markdown"></div>
</div>
</div>
</blockquote>
</div>
<div class="gmail_msg m_4946763772391147942bloop_markdown">
<div style="margin:15px 0px" class="gmail_msg"><br class="m_4946763772391147942webkit-block-placeholder gmail_msg"></div>
</div>
</div>
</blockquote>
<blockquote type="cite" style="margin:15px 0px;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254)" class="gmail_msg">
<div style="margin-top:0px;margin-bottom:0px" class="gmail_msg">
<span class="gmail_msg">_______________________________________________</span><br class="gmail_msg">

<span class="gmail_msg">swift-evolution mailing
list</span><br class="gmail_msg">
<span class="gmail_msg"><a href="mailto:swift-evolution@swift.org" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">swift-evolution@swift.org</a></span><br class="gmail_msg">
<span class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="color:rgb(65,131,196);background-color:inherit;text-decoration:none" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class="gmail_msg">
</div>
</blockquote>
<span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254);float:none;display:inline!important" class="gmail_msg">_______________________________________________</span><br style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254)" class="gmail_msg">
<span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254);float:none;display:inline!important" class="gmail_msg">swift-evolution mailing list</span><br style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254)" class="gmail_msg">
<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 Neue',Helvetica,Arial,sans-serif;font-size:14px;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" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254)" class="gmail_msg">
<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 Neue',Helvetica,Arial,sans-serif;font-size:14px;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" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;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;background-color:rgb(254,254,254)" class="gmail_msg"></div>
</blockquote>
</div>
<br class="gmail_msg"></div>
_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote>
</div>
</div>
</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>