[swift-evolution] [Review] SE-0168: Multi-Line String Literals

Adrian Zubarev adrian.zubarev at devandartist.com
Thu Apr 13 08:20:50 CDT 2017


This is not an assumptions but a fact that the trailing spaces cannot and should not exist without an explicit annotation for precision, otherwise the backslash looses one of its main and significant functionality.



-- 
Adrian Zubarev
Sent with Airmail

Am 13. April 2017 um 15:13:50, Ricardo Parada (rparada at mac.com) schrieb:

Hi Adrian,

My conclusion that we should leave it alone is based on the assumption that someone may consider the trailing whitespace significant and correct.


On Apr 13, 2017, at 9:05 AM, Adrian Zubarev <adrian.zubarev at devandartist.com> wrote:

That would be so wrong, because it’s not obvious to anyone how long your string will be.

"""
foo
"""
I could tell you, that the string from above could have 10k characters, even if you wouldn’t believe me, as it was proposed (and included in yesterday’s toolchain) my claim can be true.

The trailing spaces needs to be stripped by the algorithm unless there is an explicit precision annotation with a backslash!

"""
foo   \
"""
That example definitely won’t have 10k characters.




-- 
Adrian Zubarev
Sent with Airmail

Am 13. April 2017 um 14:35:59, Ricardo Parada (rparada at mac.com) schrieb:

Trailing whitespace 

You also propose to remove trailing white space in each line unless the whitespace is followed by a backslash.   For example:
let str_2 = """↵    
foo··↵
"""
The two trailing whitespaces after foo would get removed according to what you are proposing. I don't like this rule. I think we are better off with leaving it alone and to the tools as Brent suggested. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170413/54d94e15/attachment.html>


More information about the swift-evolution mailing list