Theoretically that would be enough and lightweight solution to that problem, I 
could live with that. Optimally stripping them automatically would be ideal, 
however I cannot tell how complicated this might be to implement.

A warning that will popup when you included any trailing spaces in a ‘content 
line’ without the explicit backslash could also provide a fix-it to the user to 
remove these spaces. However if you can emit that warning and calculate the 
spaces to remove, than the compiler should be able to swallow these characters 
by default right?

let s1 = """↵
····content·····⇥···⇥··⇥····↵
····""""

s1 == "content" // => true
The warning itself could bite with Xcode, it depends on who’s faster to precede 
that problem. Either Xcode will strip them for you (but designing the literal 
we should not rely on that), or the compiler will emit the warning followed by 
Xcode which will strip them, which removes the warning. This would be kind of 
silly right?



-- 
Adrian Zubarev
Sent with Airmail

Am 13. April 2017 um 15:10:36, John Holdsworth (m...@johnholdsworth.com) 
schrieb:

Hi Adrian,

Would you settle for a warning for trailing whitespace in a literal?
Removing it is a bit fiddly to implement and I’m not sure it’s a feature.

John


On 13 Apr 2017, at 14:05, Adrian Zubarev via swift-evolution 
<swift-evolution@swift.org> 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

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

Reply via email to