> On Apr 28, 2016, at 4:52 PM, Brent Royal-Gordon via swift-evolution 
> <[email protected]> wrote:
> 
>> Did you ever really use multiline string literals before?
> 
> 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.
> 
> 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:
> 
>       let xml = _"<?xml version="1.0"?>
>                   "<catalog>
>                   " <book id="bk101" empty="">
>                   "     <author>\(author)</author>
>                   " </book>
>                   "</catalog>"_

Other than the underscores (I'm not sold on them but I could live with them), 
this is my favorite approach:

* It supports indented left-hand alignment, which is an important to me for 
readability
* It avoids painful `\n"+` RHS constructions
* It's easy to scan and understand
* It's simple and harmonious

-- E

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to