<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=""><blockquote type="cite" class=""><blockquote type="cite" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>let xml = _"&lt;?xml version="1.0"?&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&lt;catalog&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" &lt;book id="bk101" empty=""&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" &nbsp;&nbsp;&nbsp;&nbsp;&lt;author&gt;\(author)&lt;/author&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" &lt;/book&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&lt;/catalog&gt;”_<br class=""></blockquote></blockquote><br class=""><div class="">If I am reading and understanding this correctly:</div><div class="">This solution is still delimiter-sensitive and</div><div class="">breaks if &nbsp; &nbsp;“_ &nbsp; &nbsp; delimiter is found somewhere within the data,</div><div class="">because it is interpreted as end-of-string.</div><div class=""><br class=""></div><div class="">I wrote already about my solution &nbsp;&nbsp;</div><div class="">which solves the above deficiency,&nbsp;</div><div class="">because it does not use delimiters at all.</div><div class=""><br class=""></div><div class="">I have thought it all over and cleaned it up. Here it is again,</div><div class="">hopefully this description is more clear and readable.</div><div class=""><br class=""></div><div class="">Data Line Operators.&nbsp;</div><div class=""><br class=""></div><div class=""><div class="">For convenience, I call these \\ and \@ : &nbsp;“data-line-operators” .</div><div class="">(of course, they are pseudo operators)&nbsp;</div><div class="">Other two? character combinations for these operators are also possible.&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class="">The &nbsp;\@ &nbsp;data-line-operator: &nbsp;&nbsp;</div><div class="">&nbsp; &nbsp; &nbsp;- &nbsp;takes character data "as-is” without any conversion.</div><div class="">&nbsp; &nbsp; &nbsp;- &nbsp;respects (includes) source-file line terminators.</div></div><div class="">&nbsp; &nbsp; &nbsp;- &nbsp;all spaces in-between and up to the source line's end are included.</div><div class="">&nbsp; &nbsp; &nbsp;- &nbsp;comments // are not seen as comments but read as data.&nbsp;</div><div class="">&nbsp; &nbsp; &nbsp;- &nbsp;the \@ on its own (without anything else to the right) is implicitly an empty line. &nbsp;</div><div class="">&nbsp; &nbsp;</div><div class=""><br class=""></div><div class=""><div class="">The &nbsp;\\ &nbsp; data-line-operator: &nbsp; &nbsp;</div><div class="">&nbsp; &nbsp;- &nbsp;converts escaped chars like \t \n &nbsp;and \(var) substitution, as with “normal" string literals.</div><div class="">&nbsp; &nbsp;- &nbsp;ignores trailing spaces and source-file line terminators.</div></div><div class="">&nbsp; &nbsp;- &nbsp;respects &nbsp;// comments on the same line and will not include these as data.&nbsp;</div><div class="">&nbsp; &nbsp;- &nbsp;the &nbsp;\\ on its own is interpreted as \n (line feed) &nbsp;thus (optionally) eliminating the&nbsp;</div><div class="">&nbsp; &nbsp; &nbsp; need for &nbsp;\n usage.&nbsp;</div></div><div class=""><br class=""></div><div class="">Both operators allow 0…n spaces/tabs on its left side,&nbsp;</div><div class="">thus indentation is supported.</div><div class=""><br class=""></div><div class="">Example 1. The \@ operator:&nbsp;</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;// 1. &nbsp;multi-line string literal with data lines as is.&nbsp;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// It loads each line (part) up to and including the source-file-line- end:</div><div class=""><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// you can use all available characters without problems,&nbsp;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// even \\ and \@ &nbsp;thus allowing you to nest e.g. Swift statements... &nbsp;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;let xml = &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\@&lt;?xml version="1.0"?&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\@ &nbsp;&lt;catalog&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\@ &nbsp; &nbsp;&lt;book id="bk101" empty=“”&gt; &nbsp; &nbsp; &nbsp;// this is not regarded as a comment.<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\@ &nbsp; &nbsp; &nbsp; &lt;author&gt;//<span style="background-color: rgb(255, 255, 255);" class=""><font color="#2c353c" face="Source Sans Pro, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif" size="3" class=""><i class="">¯\"_(ツ)_//</i></font></span>&lt;/author&gt;</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\@ &nbsp; &nbsp;&lt;/book&gt;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\@ &nbsp;&lt;/catalog&gt;&nbsp;</div><div class="">&nbsp;</div></div><div class=""><br class=""></div><div class="">&nbsp; &nbsp;Example 2, The \\ operator:&nbsp;</div><div class="">&nbsp; &nbsp;// Multi-line string literal with data lines with \n \t etc. respected:&nbsp;</div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var str =</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="smb://This" class="">\\This</a> is line one.\nThis is line two, with a few \t\t\t tabs in it...</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\\ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="smb://This" class="">\\This</a> is line three: there are \(cars) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // this is a comment.</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\\ waiting in the garage. This is still line three</div><div class=""><br class=""></div><div class="">&nbsp;The first \@ or \\ must be on a new line, this is an error:</div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; &nbsp;let str = &nbsp;/@data data data data…...</div><div class="">&nbsp; &nbsp; &nbsp;/@data………….</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class="">A block of \@ &nbsp;or \\ lines must be contiguous: with no other lines in-between.</div><div class="">An empty line or other source line implicitly ends the&nbsp;</div><div class="">\\ or \@ block of lines. There is no terminator.&nbsp;</div><div class=""><br class=""></div></div><div class="">&nbsp;\@ and \\ &nbsp;lines can be mixed together in the same block.</div><div class="">&nbsp;Should this be allowed?&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Imho even easier to understand and simple.</div><div class=""><br class=""></div><div class=""><div class="">I could make a proposal for this later in May.</div></div><div class=""><br class=""></div><div class="">@Vladimir: sorry I didn’t respond directly on your email</div><div class="">You’re right. Our ideas about this have some similarity?&nbsp;</div><div class="">Your point:&nbsp;</div><div class="">&nbsp; &nbsp;"and I believe I can prove we need some start-of-line marker)” :</div><div class="">&nbsp;I think so too, that’s why I suggest the \\ and \@ data-line-operators.&nbsp;</div><div class="">as described here. &nbsp;</div><div class=""><br class=""></div><div class="">Too busy, packing things to move to <a href="http://www.speyer.de" class="">www.speyer.de</a></div><div class="">I will read swift-evolution, but will probably not</div><div class="">respond until after the 12th of May or so.</div><div class=""><br class=""></div><div class="">Although away, some feedback would be nice, thank you.</div><div class=""><br class=""></div><div class="">Kind Regards</div><div class="">TedvG</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Fri, 29 Apr 2016 08:20:34 -0600 Erica Sadun wrote:&nbsp;<br class=""><br class=""><blockquote type="cite" class=""></blockquote><blockquote type="cite" class=""><blockquote type="cite" class="">On Apr 28, 2016, at 4:52 PM, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""><blockquote type="cite" class="">Did you ever really use multiline string literals before?<br class=""></blockquote><br class="">Yes. I used Perl in the CGI script era. Believe me, I have used every quoting syntax it supports extensively, including `'` strings, `"` strings, `q` strings, `qq` strings, and heredocs. This proposal is educated by knowledge of their foibles.<br class=""><br class="">As outlined in the "Future directions for string literals in general" section, I believe alternate delimiters (so you can embed quotes) are a separate feature and should be handled in a separate proposal. Once both features are available, they can be combined. For instance, using the `_"foo"_` syntax I sketch there for alternate delimiters, you could say:<br class=""><br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>let xml = _"&lt;?xml version="1.0"?&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&lt;catalog&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" &lt;book id="bk101" empty=""&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" &nbsp;&nbsp;&nbsp;&nbsp;&lt;author&gt;\(author)&lt;/author&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" &lt;/book&gt;<br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&lt;/catalog&gt;"_<br class=""></blockquote><br class="">Other than the underscores (I'm not sold on them but I could live with them), this is my favorite approach:<br class=""><br class="">* It supports indented left-hand alignment, which is an important to me for readability</blockquote><blockquote type="cite" class="">* It avoids painful `\n"+` RHS constructions<br class=""></blockquote>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;^ what are RHS constructions ?&nbsp;<br class=""><blockquote type="cite" class="">* It's easy to scan and understand<br class="">* It's simple and harmonious<br class=""></blockquote>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<blockquote type="cite" class="">— E<br class=""></blockquote></div><div class=""><br class=""></div></body></html>