[swift-evolution] multi-line string literals.

Brent Royal-Gordon brent at architechies.com
Wed Apr 27 09:33:27 CDT 2016


> I expect to be able to have multiline text exactly *"as-is"* in my source file. No escaping, no interpolation, etc. I believe this should be a target of the proposal.

I think that's a great feature we should also add. I just think it's a *different* feature from this one. That's why I listed it in the "Fixing other string literal readability issues" part of the "Alternatives considered" section as something I think is worth fixing.

> Otherwise, I reject to see any reason to introduce anything new at this area - we already can concatenate strings and place them on next line and escape special characters.

Sure, but it's a lot less easy to understand what's going on. See the examples in the "Motivation" and "Proposed solution" sections.

> Also, what if I need to have spaces *at the end of string* ? Editor can just trimmed them, and we can't clearly see them.

One way to address this is with a "zero-width escape", an escape which doesn't actually insert anything but merely breaks up sequences and protects whitespace in front of it.

Of course, using tools which don't modify whitespace in string literals since doing so affects the program's behavior is probably the "correct" answer here...

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list