[swift-evolution] multi-line string literals.

Uli Kusterer kusterer at orangejuiceliberationfront.com
Tue Apr 26 20:36:12 CDT 2016


On 27 Apr 2016, at 03:24, Brent Royal-Gordon <brent at architechies.com> wrote:
>> Just ignore me if that's been covered in the archives already (there is a lot there, I'm still catching up), but is there a reason we can't just allow newlines in the existing string constants and be done with it? Since they've been invalid so far, nobody has code that contains line breaks that could be broken. At worst the code formatter would have to be told not to indent such lines, but beyond that, why are newlines in strings not permitted?
> 
> In short: Runaway strings. If you forget to include an ending ", the resulting error may be miles away from where you actually made a mistake.

 Doesn't strike me as a problem needing a solution, though. Strings are syntax-colored differently than actual code. So if it's really runaway, you're likely to notice the wrong color. And the likelihood  of the code actually still compiling after grabbing the next random quote to terminate its string is rather small, too.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://stacksmith.org






More information about the swift-evolution mailing list