<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=""><div class="">The main issue here is recovery. If you see a newline in a string, is it more likely that the literal is intended to go on for multiple lines, or that the user hasn't finished typing the current line? If you assume the former, your "in a string" state will toggle with the <i class="">next</i>&nbsp;double-quote you see, and you'll get a cascade of errors down the whole file.</div><div class=""><br class=""></div><div class="">(The general principle: when adding new syntax, it's important to consider not just complete, correct code, but also the possible error and intermediate states that the compiler and SourceKit have to deal with.)</div><div class=""><br class=""></div><div class="">Jordan</div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 11, 2015, at 23:02, Alex Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="">What is the reason that normal strings "..." don't support newlines? It's not traditionally seen in C-inspired languages, but it's hardly unusual outside that sphere[*]. Ruby and HTML are probably the most common examples, but apparently OCaml and Lisps also allow it?</div><div class=""><br class=""></div><div class="">Then we can simply use</div><div class=""><br class=""></div><div class="">1. "..." strings as the verbatim literal, preserving indentation and leading newlines as written.</div><div class=""><br class=""></div><div class="">2. """...""" strings as the non-verbatim literal, reducing indentation to that of the least indented line, and removing the leading newline if it exists.</div><div class=""><br class=""></div><div class="">[*] As seen earlier&nbsp;<a href="http://rigaux.org/language-study/syntax-across-languages.html#StrngMltLine" target="_blank" class="">http://rigaux.org/language-study/syntax-across-languages.html#StrngMltLine</a></div></div><div class="gmail_extra" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""><div class="gmail_quote">On Sat, Dec 12, 2015 at 6:25 AM, Travis Tilley via swift-evolution<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class=""><div class="gmail_default" style="font-family: verdana, sans-serif;"><span style="font-family: arial, sans-serif;" class="">That's another great example that I hadn't even thought of.</span></div><div class="gmail_default" style="font-family: verdana, sans-serif;"><span style="font-family: arial, sans-serif;" class=""><br class=""></span></div><div class="gmail_default" style="font-family: verdana, sans-serif;"><span style="font-family: arial, sans-serif;" class=""><br class=""></span></div><div class="gmail_default" style="font-family: verdana, sans-serif;"><span style="font-family: arial, sans-serif;" class="">- Travis Tilley</span></div><div class="gmail_default" style="font-family: verdana, sans-serif;"><span style="font-family: arial, sans-serif;" class=""><br class=""></span></div><div class="gmail_default" style="font-family: verdana, sans-serif;"><span style="font-family: arial, sans-serif;" class=""><br class=""></span></div><div class="gmail_default" style="font-family: verdana, sans-serif;"><span style="font-family: arial, sans-serif;" class="">On Fri, Dec 11, 2015 at 7:43 PM, Jason Dusek<span class="Apple-converted-space">&nbsp;</span></span><span dir="ltr" style="font-family: arial, sans-serif;" class="">&lt;<a href="mailto:jason.dusek@gmail.com" target="_blank" class="">jason.dusek@gmail.com</a>&gt;</span><span style="font-family: arial, sans-serif;" class=""><span class="Apple-converted-space">&nbsp;</span>wrote:</span><br class=""></div><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-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div dir="ltr" class=""><span class=""><p style="margin: 1.2em 0px !important;" class="">One use case for a slightly richer approach to indentation erasure — one that I encounter every day — is inline SQL. If it’s 10 lines or more, it should probably find expression as a<span class="Apple-converted-space">&nbsp;</span><code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; padding: 0px 0.3em; white-space: pre-wrap; border: 1px solid rgb(234, 234, 234); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline; background-color: rgb(248, 248, 248);" class="">VIEW</code><span class="Apple-converted-space">&nbsp;</span>or stored procedure; but queries like this are not unusual:<br class=""></p></span><pre style="font-family: Consolas, Inconsolata, Courier, monospace; font-size: 1em; line-height: 1.2em; margin: 1.2em 0px;" class=""><code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; white-space: pre-wrap; overflow: auto; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; border: 1px solid rgb(204, 204, 204); padding: 0.5em; color: rgb(51, 51, 51); background-color: rgb(248, 248, 248); display: block !important; background-position: initial initial; background-repeat: initial initial;" class=""><span class=""><span style="color: rgb(51, 51, 51); font-weight: bold;" class="">func</span> <span style="color: rgb(153, 0, 0); font-weight: bold;" class="">findMentions</span><span class="">(account: String)</span> -&gt; <span style="color: rgb(153, 0, 0); font-weight: bold;" class="">Array</span><span class="">&lt;String&gt;</span> </span>{
    <span style="color: rgb(51, 51, 51); font-weight: bold;" class="">let</span> db = databaseFactory().findDatabase()
    <span style="color: rgb(51, 51, 51); font-weight: bold;" class="">let</span> q = `​``<span style="color: rgb(68, 85, 136); font-weight: bold;" class="">SELECT</span> array_agg(<a href="http://mentioner.id/" target="_blank" class="">mentioner.id</a>)
                 <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">FROM</span> account
                 <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">JOIN</span> mention <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">ON</span> (<a href="http://account.id/" target="_blank" class="">account.id</a> = mentioned)
                 <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">JOIN</span> account <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">AS</span> mentioner <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">ON</span> (<a href="http://mentioner.id/" target="_blank" class="">mentioner.id</a> = mentioner)
                <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">WHERE</span> account.handle = :<span style="color: rgb(0, 128, 128);" class="">1</span>
                <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">ORDER</span> <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">BY</span> timestamp <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">DESC</span>
                <span style="color: rgb(68, 85, 136); font-weight: bold;" class="">LIMIT</span> <span style="color: rgb(0, 128, 128);" class="">1</span>`​``

    <span style="color: rgb(51, 51, 51); font-weight: bold;" class="">return</span> db.query(q).parameterize(account).run()
}
</code></pre><p style="margin: 1.2em 0px !important;" class="">Moving everything below<span class="Apple-converted-space">&nbsp;</span><code style="font-size: 0.85em; font-family: Consolas, Inconsolata, Courier, monospace; margin: 0px 0.15em; padding: 0px 0.3em; white-space: pre-wrap; border: 1px solid rgb(234, 234, 234); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; display: inline; background-color: rgb(248, 248, 248);" class="">q</code><span class="Apple-converted-space">&nbsp;</span>seems infelicitous, at best. However, I do see the appeal of basing the rule on the position of the backticks.</p><p style="margin: 1.2em 0px !important;" class="">Best Regards,</p><p style="margin: 1.2em 0px !important;" class="">Jason Dusek</p></div></blockquote><div class="">&nbsp;</div></div></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=ufQ1sKmNNtjEC-2BBUON-2BgZPd8t-2F4PFTin0qlI9lRM0AlI2I3pNy2PX4maTqYBy7ZknqADue9VJ1l1LYgn-2BokspEFOrXcJ8-2BaRpStVNA1SVTwxLUYE97lepIm49101-2FSys92h5oy45p-2Bn9sAP5Vw1skI3eeqqOJRo5ocCKWzxlgPk6id9EE-2F2-2FSIjvMAMvza0Sj1XFnwt8N5mmnhz3-2BMuqXBWqlTHZ4UYLh-2FOVtQLNfYY-3D" alt="" width="1" height="1" border="0" style="min-height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span class="Apple-converted-space">&nbsp;</span><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""><br class=""></blockquote></div><br class=""></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=ZEz4qHYnXhPr3bBPu-2FxP4tN3HfWKL-2FtJpqkQ0gkOVSDzOKvu-2F9ULN8MK5t91vnjbipEmJNA3p3zRkVAjUmcePrgUVcGP-2F1Q8qO-2FCcExoKl9enXb9LJOYyQwoCCLDqhN3pKKYPboWt3A7hgkknJq4Q0rQKhDdcibv7Nj3eqThhZ2ZJyFTwIvenFnj6iV1hX-2FeqN27qlC8Y12256das-2FbIxYIIeK714kT-2FciEyXd90I1s-3D" alt="" width="1" height="1" border="0" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></body></html>