[swift-evolution] multi-line string literals.

Brent Royal-Gordon brent at architechies.com
Thu Apr 28 17:52:38 CDT 2016


> Did you ever really use multiline string literals before?

Yes. I used Perl in the CGI script era. Believe me, I have used every quoting syntax it supports extensively, including `'` strings, `"` strings, `q` strings, `qq` strings, and heredocs. This proposal is educated by knowledge of their foibles.

As outlined in the "Future directions for string literals in general" section, I believe alternate delimiters (so you can embed quotes) are a separate feature and should be handled in a separate proposal. Once both features are available, they can be combined. For instance, using the `_"foo"_` syntax I sketch there for alternate delimiters, you could say:

	let xml = _"<?xml version="1.0"?>
	            "<catalog>
	            " <book id="bk101" empty="">
	            "     <author>\(author)</author>
	            " </book>
	            "</catalog>"_

Basically, I am trying very, *very* hard not to let this proposal turn into "here's a huge pile of random string literal features which will become a giant catfight if we debate them all at once". Clearly this message is not getting through, but I'm not sure how I should edit the proposal to make it clear enough.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list