[Accepted] SE-0182 - String Newline Escaping

(Chris Lattner) #1

Proposal Link: https://github.com/apple/swift-evolution/blob/master/proposals/0182-newline-escape-in-strings.md

The review of SE-0182 “ String Newline Escaping” ran from July 12…17, 2017. Feedback for the feature was positive, and the proposal is accepted with revision based on community discussion.

The core team requests that the feature be restricted to multi-line string literals, so it is a compile-time error to use in a single-quoted string. As was pointed out during review discussion, enabling escaped newlines for single line strings means that they are not single line anymore, and enabling single quoted strings to span multiple lines does not solve a strongly motivated glaring problem, since they can be upgraded to triple quoted strings. This change reduces the scope of the proposal, allowing proponents of this to restart the discussion later if and when there is compelling evidence (e.g. specific important use cases) to reconsider.

The core team also discussed feedback about the whitespace rules proposed, and agreed with the proposed design. It also discussed whether \ should be allowed on the line immediately following the close """ and agreed that it was best to not allow it in this go-around.

Thank you to John Holdsworth, David Hart, and Adrian Zubarev for driving this proposal forward. Please revise the proposal, and if an adjusted PR can be made soon, we can get it in for Swift 4. Thanks!

Chris Lattner
Review Manager

Significant Whitespace at the End of Multiline String
Significant Whitespace at the End of Multiline String