[swift-evolution] [Review] SE-0168: Multi-Line String Literals

Tony Allevato tony.allevato at gmail.com
Thu Apr 6 14:58:44 CDT 2017


On Thu, Apr 6, 2017 at 12:35 PM Joe Groff via swift-evolution <
swift-evolution at swift.org> wrote:

> Hello Swift community,
>
> The review of SE-0168 "Multi-Line String Literals" begins now and runs
> through April 12, 2017. The proposal is available here:
>
>
> https://github.com/apple/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md
>
>
> Reviews are an important part of the Swift evolution process. All reviews
> should be sent to the swift-evolution mailing list at:
>
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
> or, if you would like to keep your feedback private, directly to the
> review manager. When replying, please try to keep the proposal link at the
> top of the message:
>
> Proposal link:
>
>
>
> https://github.com/apple/swift-evolution/blob/master/proposals/0167-swift-encoders.md
>
>
> Reply text
>
> Other replies
>
>
> *What goes into a review?*
>
> The goal of the review process is to improve the proposal under review
> through constructive criticism and, eventually, determine the direction of
> Swift. When writing your review, here are some questions you might want to
> answer in your review:
>
> • What is your evaluation of the proposal?
>

+0.75. I think the language needs a good facility to support multi-line
string literals in code, and the Python triple-quote syntax is the cleanest
of all the ones I've used among various languages.

I would like to see some more detail/clarification in the proposal before I
could give it a full +1 though:

1. The proposal shows that double quotes don't need to be escaped in these
literals; similarly, string interpolation is supported with the usual
\(...) syntax. How is escaping of other characters handled within these
strings? Is it affected or not? If I include \n in my multi-line string,
does that insert a newline at that location, or is it the literal "\n"? (I
expect the former, but I'd like to see it spelled out.)

2. If I want to be terrible and include the literal """ in the content of
my string, how would I escape that? Is \"\"\" sufficient/the only way/the
right way? Does it make a difference if it's leading the line (with the
exception of whitespace) or in the middle of a line?

3. Deciding how much leading whitespace to strip based on the indentation
of the *closing* quotes seems a bit strange/magical to me, but I honestly
can't think of a cleaner way to do it. This at least makes the amount of
leading space something that I can explicitly control (and IDEs like Xcode
could color in the margin accordingly to make it clear how much of the
leading space is actually part of the string).



> • Is the problem being addressed significant enough to warrant a change to
> Swift?
>

Yes. While Apple platforms can just load large strings from bundled
resources, that doesn't support string interpolation, and non-Apple
platforms can also benefit from this feature.



> • Does this proposal fit well with the feel and direction of Swift?
>

Yes.


> • If you have used other languages or libraries with a similar feature,
> how do you feel that this proposal compares to those?
>

It lines up most closely with Python's multi-line strings, which I prefer
to shell-style heredocs with arbitrary begin-end tokens.



> • How much effort did you put into your review? A glance, a quick reading,
> or an in-depth study?
>

Read the proposal.


>
> More information about the Swift evolution process is available at:
>
> https://github.com/apple/swift-evolution/blob/master/process.md
>
>
> Thank you,
>
> -Joe
> Review Manager
> _______________________________________________
> 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/20170406/38a04a7c/attachment.html>


More information about the swift-evolution mailing list