The result is not surprisingly to me, at least not if I follow the simplicity 
of my gist.

"Line 1····Line2"

Notice I put quotes around the string to better showcase the result here in the 
mailing list.

The backslash serves two jobs in lines s0 to s(n - 1):

Disable new line injection.
Trailing space precision.
The backslash serves only one job for the line sn (or as I also refer it as 
‘last content line’):

Trailing space precision.
Here some other example:

"""
Line 1···\n\
Line 2··\
"""
Result:

"Line 1···\nLine 2··"

Another one:

"""
Line 1···\n\
Line 2·····················
"""
Result:

"Line 1···\nLine 2"

The second line cannot and should not contain ····················· because 
right (trailing) precision is handled by the backslash, where left (leading) 
precision is handled by the indent stripping algorithm calculated from the 
indent prefix before the closing delimiter """.



-- 
Adrian Zubarev
Sent with Airmail

Am 13. April 2017 um 15:29:52, Ricardo Parada (rpar...@mac.com) schrieb:

I don't care much for trailing whitespace but I thought we should respect the 
trailing whitespace in the event that it is significant.  

If I'm worried about precision in a string, I turn on the display of whitespace 
characters and make sure everything is as expected.  

I also think it would surprise me if I put a space there and then the compiler 
removes it.

Also, what would this mean?

"""
Line 1    \
Line 2
"""

Is that backslash escaping the newline? or is it there to include the trailing 
whitespace on Line 1?  


On Apr 13, 2017, at 9:20 AM, Adrian Zubarev <adrian.zuba...@devandartist.com> 
wrote:

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 (rpar...@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.zuba...@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 (rpar...@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. 



_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to