[swift-evolution] [Review] SE-0182 - String Newline Escaping

Timothy Wood tjw at me.com
Wed Jul 12 18:15:27 CDT 2017


+1 This seems great to me.  It seems worth calling out how escaping of backslashes and escaping of newlines interact for testing:


	let s = """
	line fragment ending in backslash \\\
        and
	line fragment ending in backslash \\\
        \\followed by line fragment starting with backslash
	"""

I would expect to get "line fragment ending in backslash \\and\nline fragment ending in backslash\\\\followed by line fragment starting with backslash”, that is, escaped backslashes at the end of line fragments should be retained, and whatever concatenates line fragments shouldn’t accidentally double-interpret backslashes.

Alternatively:

	let s = """
	line ending in backslash \\
        and
	line ending in backslash \\
        \\followed by line starting with backslash
	"""

seems like it should produce the result "line ending in backslash \\\nand\nline ending in backslash\\\n\\followed by line starting with backslash”, that is, the consumption of escaped backslashes should happen before considering if there is an extra backslash on the end of the line for an escaped newline.

-tim



> On Jul 12, 2017, at 3:52 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hello Swift community,
> 
> Context: As part of winding down work on Swift 4, we are considering SE-0182 as a refinement to SE-0168.  We are specifically not opening the floodgates for new proposals just yet, and it is not considered in scope to resyntax all of multi-line string literals.  We’re just discussing this one potential small-scope refinement to an existing Swift 4 feature.
> 
> 
> The review of "String Newline Escaping" begins now and runs through July 17, 2017. The proposal is available here:
> https://github.com/apple/swift-evolution/blob/master/proposals/0182-newline-escape-in-strings.md
> 
> Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at
> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:
> 
> What goes into a review?
> 
> The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
> 
> 	• What is your evaluation of the proposal?
> 	• Is the problem being addressed significant enough to warrant a change to Swift?
> 	• Does this proposal fit well with the feel and direction of Swift?
> 	• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
> 	• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
> 
> More information about the Swift evolution process is available at:
> https://github.com/apple/swift-evolution/blob/master/process.md
> 
> 
> Thank you,
> 
> Chris Lattner
> Review Manager
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list