<div dir="ltr"><div>In Javascript, this counted as 2 lines which is fine for rendering code, not with HTML5 elements</div><div>&lt;pre&gt;&lt;code&gt;import Foundation</div><div>print(&quot;Hello World!&quot;)&lt;/code&gt;&lt;/pre&gt;</div><div><br></div><div>1st)</div><div>In Swift, it&#39;s clear to start multi-line on a new line</div><div>var code = </div><font face="monospace, monospace"><b>&quot;&quot;&quot;</b></font><div><font face="monospace, monospace">Hello World</font></div><div><font face="monospace, monospace"><b>&quot;&quot;&quot;</b></font></div><div><div><br></div><div>If Swift cannot accept the 1st syntax, below 2nd and 3rd syntax could be done better</div><div>2nd)<font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><b>var code = &quot;&quot;&quot;</b></font></div><div><font face="monospace, monospace">Hello World</font></div><div><font face="monospace, monospace"><b>&quot;&quot;&quot;</b></font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">3) </font></div><div><div><font face="monospace, monospace"><b>var code = {</b></font></div><div><font face="monospace, monospace"><b>&quot;&quot;&quot;</b></font></div><div><font face="monospace, monospace">Hello World</font></div><div><font face="monospace, monospace"><b>&quot;&quot;&quot;</b></font></div></div><div>}</div><div><br></div><div>I love the 3rd syntax.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 14, 2017 at 5:06 PM, Adrian Zubarev via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div class="m_-8340532274324014620bloop_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="m_-8340532274324014620swift">let string_1 = &quot;&quot;&quot;foo&quot;&quot;&quot;


let string_2 = &quot;&quot;&quot;
    foo
    &quot;&quot;&quot;
</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="m_-8340532274324014620swift">let string_3 = &quot;&quot;&quot;

    &quot;&quot;&quot;
</code></pre>

<p>However the equivalent for this would be:</p>

<pre><code class="m_-8340532274324014620swift">let string_4 = &quot;&quot;&quot;\n&quot;&quot;&quot;
</code></pre>

<p>Empty string in both variations: </p>

<pre><code class="m_-8340532274324014620swift">let string_5 = &quot;&quot;&quot;&quot;&quot;&quot;


let string_6 = &quot;&quot;&quot;
    &quot;&quot;&quot;
</code></pre>

<p></p></div><div class="m_-8340532274324014620bloop_original_html"><span class=""><div id="m_-8340532274324014620bloop_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="m_-8340532274324014620bloop_sign_1492160246446671104" class="m_-8340532274324014620bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div> <br></span><div><div class="h5"><p class="m_-8340532274324014620airmail_on">Am 14. April 2017 um 03:08:58, Xiaodi Wu (<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>) schrieb:</p> <blockquote type="cite" class="m_-8340532274324014620clean_bq"><span><div><div></div><div>





<div dir="ltr">On Thu, Apr 13, 2017 at 7:55 PM, Brent Royal-Gordon
<span dir="ltr">&lt;<a href="mailto:brent@architechies.com" target="_blank">brent@architechies.com</a>&gt;</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="m_-8340532274324014620gmail-">On Apr 13, 2017, at 4:48 PM, Xiaodi Wu
&lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:</span></div>
<span class="m_-8340532274324014620gmail-"><br class="m_-8340532274324014620gmail-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="m_-8340532274324014620gmail-">You say &quot;this is the example set by
`print`&quot;, but I don&#39;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="m_-8340532274324014620gmail-"><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="m_-8340532274324014620gmail-">To be more accurate, it&#39;s not `print` that
specifies this behavior, but rather the standard output stream&#39;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="m_-8340532274324014620gmail-"><br></span></div>
<div>I feel like I must be misunderstanding what you&#39;re trying to
say here, because I *think* what you&#39;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/adc54c8a4d13fbebfeb<wbr>68244bac401ef2528d6d0/stdlib/<wbr>public/core/Print.swift#L260</a>)
but doesn&#39;t even make any sense since there&#39;s a terminator
parameter on `print` but none on `write(_:)`.</div>
</div>
</blockquote>
<div><br></div>
<div>Hmm, you&#39;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 == &quot;\n&quot;</div>
<div>              ? &quot;\n&quot;</div>
<div>              :
scalar.escaped(asASCII: true)</div>
<div>        }</div>
<div>        print(ascii.joined(separator: &quot;&quot;),
terminator: &quot;&quot;)</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="m_-8340532274324014620gmail-HOEnZb"><font color="#888888"><br></font></span>
<div>
<div>
<div style="font-size:12px"><span class="m_-8340532274324014620gmail-HOEnZb"><font color="#888888">-- </font></span></div>
<div style="font-size:12px"><span class="m_-8340532274324014620gmail-HOEnZb"><font color="#888888">Brent Royal-Gordon</font></span></div>
<div style="font-size:12px"><span class="m_-8340532274324014620gmail-HOEnZb"><font color="#888888">Architechies</font></span></div>
</div>
</div>
<span class="m_-8340532274324014620gmail-HOEnZb"><br></span></div>
</blockquote>
</div>
<br></div>
</div>


</div></div></span></blockquote></div></div></div><div class="m_-8340532274324014620bloop_markdown"><p></p></div></div><br>______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div>