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

Joe Groff jgroff at apple.com
Thu Apr 20 11:57:58 CDT 2017


> On Apr 19, 2017, at 3:27 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> On Wed, Apr 19, 2017 at 5:24 PM, Joe Groff <jgroff at apple.com <mailto:jgroff at apple.com>> wrote:
> 
> > On Apr 19, 2017, at 3:16 PM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> >
> > We had a very full debate about which way was superior during review; it was proposed to behave one way and the core team decided on the other. We have to let settled decisions be settled: that's the only way Swift Evolution will continue to work.
> 
> I'm asking the core team for clarification on the point of the closing newline.
> 
> Cool, thanks. Please do remind them, though, that not stripping the closing newline (which is what was originally proposed) *and* not having the option of using `\` to elide newlines (which is contrary to what was originally proposed) would mean that all multi-line strings would mandatorily end in a newline.

To clarify, the core team's decision is that one trailing newline should be elided before the closing delimiter. This maintains one consistent rule for both ends of the literal, so """\n and \n""" can be mentally understood as balanced delimiters. as Xiaodi noted, it would otherwise be impossible to write a literal without a trailing newline without scope-creeping the design with additional features.

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170420/ec2a1b30/attachment-0001.html>


More information about the swift-evolution mailing list