<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>I think I found another argument of not to inject a new line after the last content line, even though it’s not a strong argument.</p>
<p>Consider these two examples:</p>
<pre><code class="swift">let string_1 = """foo"""
let string_2 = """
foo
"""
</code></pre>
<p>What’s the intuitive result you’d expect without taking all the long talk from the list into account?</p>
<p>Personally, I’d say <code>string_1 == string_2</code> is true.</p>
<p>Now you’d might think how about the blank line as an example?</p>
<pre><code class="swift">let string_3 = """
"""
</code></pre>
<p>However the equivalent for this would be:</p>
<pre><code class="swift">let string_4 = """\n"""
</code></pre>
<p>Empty string in both variations: </p>
<pre><code class="swift">let string_5 = """"""
let string_6 = """
"""
</code></pre>
<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_1492160246446671104" 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 14. April 2017 um 03:08:58, Xiaodi Wu (<a href="mailto:xiaodi.wu@gmail.com">xiaodi.wu@gmail.com</a>) schrieb:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>
<title></title>
<div dir="ltr">On Thu, Apr 13, 2017 at 7:55 PM, Brent Royal-Gordon
<span dir="ltr"><<a href="mailto:brent@architechies.com" target="_blank">brent@architechies.com</a>></span> wrote:<br>
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div style="word-wrap:break-word">
<div>
<blockquote type="cite">
<div><span class="gmail-">On Apr 13, 2017, at 4:48 PM, Xiaodi Wu
<<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>> wrote:</span></div>
<span class="gmail-"><br class="gmail-m_9083929276519824393Apple-interchange-newline"></span>
<div>
<blockquote class="gmail_quote" 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;margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div style="word-wrap:break-word">
<div>
<div><span class="gmail-">You say "this is the example set by
`print`", but I don't think anything else actually *follows* that
example. No other I/O operation in Swift behaves this
way.</span></div>
</div>
</div>
</blockquote>
<div 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">
<span class="gmail-"><br></span></div>
<div 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">
<span class="gmail-">To be more accurate, it's not `print` that
specifies this behavior, but rather the standard output stream's
implementation of `TextOutputStream.write(_:)`. Swift *explicitly*
leaves this choice up to the TextOutputStream-conforming type. That
is, the behavior is up to the receiver and not the argument of a
call to `TextOutputStream.write(_:)`.</span></div>
</div>
</blockquote>
<span class="gmail-"><br></span></div>
<div>I feel like I must be misunderstanding what you're trying to
say here, because I *think* what you're trying to say is that
`TextOutputStream.write(_:)` is what decides whether to add the
terminator, which is not only totally wrong (see <a href="https://github.com/apple/swift/blob/adc54c8a4d13fbebfeb68244bac401ef2528d6d0/stdlib/public/core/Print.swift#L260" target="_blank">https://github.com/apple/<wbr>swift/blob/<wbr>adc54c8a4d13fbebfeb68244bac401<wbr>ef2528d6d0/stdlib/public/core/<wbr>Print.swift#L260</a>)
but doesn't even make any sense since there's a terminator
parameter on `print` but none on `write(_:)`.</div>
</div>
</blockquote>
<div><br></div>
<div>Hmm, you're right here with respect to `print()`. It is,
however, explicitly contemplated in the documentation for
`TextOutputStream.write(_:)` that conforming types can also
determine whether or not to append a terminator, and which, inside
their implementation of `write`. The example given in the
documentation is:</div>
<div><br></div>
<div>```</div>
<div>
<div>struct ASCIILogger: TextOutputStream {</div>
<div> mutating func write(_ string: String) {</div>
<div> let ascii =
string.unicodeScalars.lazy.map { scalar in</div>
<div> scalar == "\n"</div>
<div> ? "\n"</div>
<div> :
scalar.escaped(asASCII: true)</div>
<div> }</div>
<div> print(ascii.joined(separator: ""),
terminator: "")</div>
<div> }</div>
<div>}</div>
</div>
<div>```</div>
<div><br></div>
<div><br></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div style="word-wrap:break-word"><span class="gmail-HOEnZb"><font color="#888888"><br></font></span>
<div>
<div>
<div style="font-size:12px"><span class="gmail-HOEnZb"><font color="#888888">-- </font></span></div>
<div style="font-size:12px"><span class="gmail-HOEnZb"><font color="#888888">Brent Royal-Gordon</font></span></div>
<div style="font-size:12px"><span class="gmail-HOEnZb"><font color="#888888">Architechies</font></span></div>
</div>
</div>
<span class="gmail-HOEnZb"><br></span></div>
</blockquote>
</div>
<br></div>
</div>
</div></div></span></blockquote></div><div class="bloop_markdown"><p></p></div></body></html>