[swift-evolution] [Review] SE-0168: Multi-Line String Literals
Ricardo Parada
rparada at mac.com
Thu Apr 13 09:38:59 CDT 2017
That would be good, I think because it would force everyone to be precise in regards to trailing whitespace. And I don't see that as a bad thing.
> On Apr 13, 2017, at 9:54 AM, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
>
> 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 <mailto:mac at johnholdsworth.com>) schrieb:
>
>> \n\
>> would work
>>
>>> On 13 Apr 2017, at 14:44, John Holdsworth <mac at johnholdsworth.com <mailto: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 <mailto: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?
>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170413/bc021a34/attachment.html>
More information about the swift-evolution
mailing list