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

Joe Groff jgroff at apple.com
Wed Apr 19 17:02:10 CDT 2017


> On Apr 19, 2017, at 2:43 PM, Adrian Zubarev <adrian.zubarev at devandartist.com> wrote:
> 
> 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
> """
That seems like a reasonable thing to warn about. That also reminds me, blank lines should be accepted within a literal even if they aren't "indented" with invisible whitespace.

-Joe

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


More information about the swift-evolution mailing list