[swift-evolution] [Review] SE-0168: Multi-Line String Literals
Adrian Zubarev
adrian.zubarev at devandartist.com
Thu Apr 13 08:54:18 CDT 2017
I was really confused by your last reply. Actually I’ve got a better idea for a fix-it. :-)
let str_8 = """↵
····foo··········↵
····"""
warning: line # includes trailing space characters in multi-line string literal
····foo··········
~~~~~~~~~~
Fix-it: Insert "\n\" (after these space characters)
The fix-it will inset \n\ after all your space characters, so the developer is kinda forced to strip them manually to ····foo or let the IDE add \n\ if he really needs that precision.
That would work. :)
--
Adrian Zubarev
Sent with Airmail
Am 13. April 2017 um 15:46:52, John Holdsworth (mac at johnholdsworth.com) schrieb:
\n\
would work
On 13 Apr 2017, at 14:44, John Holdsworth <mac at johnholdsworth.com> wrote:
I’ve never understood how you mean "explicit backslash". backslash has specific roles
and at the moment it is assigned to meaning standard escapes or "don’t include this next
newline in the literal". I can’t see how it could be reassigned to mean “include whitespace”
without loosing the option to concatenate lines.
fix-its are beyond my pay grade so that’ll have to wait until Apple looks at the implementation!
On 13 Apr 2017, at 14:32, Adrian Zubarev <adrian.zubarev at devandartist.com> wrote:
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170413/c668fb02/attachment.html>
More information about the swift-evolution
mailing list