[swift-evolution] multi-line string literals.

Cole Campbell cole.m.campbell at icloud.com
Fri Apr 29 01:02:50 CDT 2016

I think the proposal is very clear on its intended scope.

I really like this idea. It's readable, and it's as simple and uncluttered as I think it could be while still allowing the tabbing of new lines. The one thing I dislike about multi line strings in Ruby is how you have to left align each new line, which can really disrupt the visual flow of your code, especially if you are several tabs of indentation deep.

I would love to see the addition (at some point) of the ability to escape all whitespaces preceding the new line, if that line does not begin with a quote and thus is meant to be a direct continuation of the preceding line. That way you could maintain your indentation without adding whitespaces between what are meant to be subsequent characters in the string literal.

On Apr 28, 2016, at 5:52 PM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> 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>"_
> Basically, I am trying very, *very* hard not to let this proposal turn into "here's a huge pile of random string literal features which will become a giant catfight if we debate them all at once". Clearly this message is not getting through, but I'm not sure how I should edit the proposal to make it clear enough.
> -- 
> Brent Royal-Gordon
> Architechies
> _______________________________________________
> 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/20160429/b5a4da6f/attachment.html>

More information about the swift-evolution mailing list