> On Apr 6, 2017, at 12:35 PM, Joe Groff <[email protected]> wrote:
> 
> Hello Swift community,
> 
> The review of SE-0168 "Multi-Line String Literals" begins now and runs 
> through April 12, 2017. The proposal is available here:
> 
> https://github.com/apple/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md
>  
> <https://github.com/apple/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md>
> 

> Long strings are strings delimited by """triple quotes""" that can contain 
> newlines and individual " characters without the need to escape them.

Are the set of backslash-escapes inside a long string identical to the set used 
in short strings? I assume that \" inside a long string is interpreted as an 
escaped double-quote; otherwise there would be no way to write """ inside a 
long string.


> To allow free formatting of the literal an indentation stripping operation is 
> applied whereby any whitespace characters in front of the closing delimiter 
> are removed from each of the lines in the literal. As part of this process 
> any initial linefeed is also removed. This allows the developer to paste 
> literal content directly into the string without modification. Some concern 
> has been expressed about could introduce confusion if the prefixing 
> indentation of each line does not contain the same whitespace characters, 
> though this can be checked for by a compiler warning.

To clarify, is this the intended algorithm? 
    if the source code of the closing delimiter matches regex(\n\s+""") {
        collect the sequence of whitespace characters between the newline and 
the delimiter
        remove exactly that sequence of characters, if present, from the front 
of each source-code line after the line containing the opening delimiter
        if a line does not start with those characters, emit a warning
    }


-- 
Greg Parker     [email protected]     Runtime Wrangler


_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to