[swift-evolution] [Accepted] SE-0168: Multi-Line String Literals
Adrian Zubarev
adrian.zubarev at devandartist.com
Wed Apr 19 16:43:40 CDT 2017
First of all, thank you for accepting the proposal. However I still have one single concern left about the trailing whitespaces. Will the final implemented version raise a warning or produce an error when there are trailing whitespaces?
The whole idea of a trailing \ was in first place to prevent new line injection but also for trailing whitespace character precision.
The following example could have 1000 characters, but a different developer who reads the code wouldn’t even notice.
"""
Foo<space><space>…<space>
Bar
"""
That’s what the trailing backslash was meant for. To prevent unwanted whitespaces, or if you really need them, to force you to be precise about them.
"""
Foo<space><space><space>\n\
Bar
"""
--
Adrian Zubarev
Sent with Airmail
Am 19. April 2017 um 22:03:31, Joe Groff via swift-evolution (swift-evolution at swift.org) schrieb:
- It should be clarified that multiline strings support the same escapes and interpolations as single-line strings. This allows a literal """ to be written \""". Discussion on the list raised the idea of allowing a line to end with \ to "escape" the newline and elide it from the value of the literal; the core team had concerns about only allowing that inside multi-line literals and felt that that could also be considered later as an additive feature.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170419/96ff2143/attachment.html>
More information about the swift-evolution
mailing list