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


(Karim Nassar) #1

https://github.com/apple/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md<https://github.com/apple/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md>
  • What is your evaluation of the proposal?

-1 because I don’t think this proposal is fully baked. We definitely need this feature, but we need more discussion on the details.

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

Yes. There are many practical and pragmatic reasons to want to embed multi-line string literals in code, and most of these use-cases are hampered or made more significantly more fiddly with continuation characters or concatenation, for all the reasons already discussed.

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

This is where things break down. This proposal feels like we took Python’s approach and slapped it on Swift. There are more ways to do this than identical open-close delimiters with magic whitespace stripping.

Non-exhasutive ideas for other options we should weigh (all spellings are straw-men):

1. Open/close delimiters:
    let msg = @“ // optionally: @4” to strip 4 chars leading whitespace
        this is a
        message
    "@

2. A “Swifty” Heredoc compiler directive:
    let msg = #stringUntil(END) // optionally: #stringUntil(END, stripLeading: 4)
        this is a
        message
    END

3. Other options as mentioned on this list

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

This is pretty much the Python approach with some additional vague whitespace-stripping rules. We need to think it through better and then re-introduce after proper discussion.

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

Read the proposal, followed the discussion.

···

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

More information about the Swift evolution process is available at:

https://github.com/apple/swift-evolution/blob/master/process.md <https://github.com/apple/swift-evolution/blob/master/process.md>

Thank you,

-Joe
Review Manager
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution