[swift-evolution] multi-line string literals.

Ricardo Parada rparada at mac.com
Thu May 5 15:42:52 CDT 2016


I like the continuation quote. It makes the code stay pretty. It doesn't break the indentation of your code. If you take out the continuation quote then things look out of place, as if someone pasted text in the middle of your code by mistake. I don't like the heredoc notation either for the same reasons.

I envision being able to type the opening multi line quote, i.e. M" and then pasting multi line text from the clipboard. The editor would do a smart paste prepending the lines of text with the continuation character.  

Let's keep our code looking  pretty and focus on the main things:

1. Allow interpolation 
2. Remove the need to add the \n character for each line
3. Remove the need to escape the double quote and apostrophe
4. Keep it simple

I would be fine just with this:

let xml = M"<?xml version="1.0"?>
          "<catalog>
          " <book id="bk101" empty="">
          "     <author>\(author)</author>
          " </book>
          "</catalog>



> On May 5, 2016, at 9:17 AM, David Hart via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On 05 May 2016, at 12:30, Michael Peternell via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> it's not a secret that I'm not a big fan of the proposal. The third draft doesn't change this and it's unlikely that any future draft will, because for me, the problem are the continuation quotes, and for Brent it seems like they are a must-have-feature (correct me if I'm wrong.)
> 
> I agree with all you said. I’m fairly sure I would never vote for Brent’s proposal simply because of the existence of continuation quotes, no matter the amount of reasoning behind it. They are simply too unwieldy, cumbersome and unfriendly to modification.
> 
> I could see either your proposal, or your proposal without the HERE_DOCs but using Tyler’s/Scala’s .stripMargin. Do you think you could start a formal proposal?
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160505/472f815a/attachment.html>


More information about the swift-evolution mailing list