[swift-evolution] multi-line string literals.

Ricardo Parada rparada at mac.com
Mon Apr 3 10:10:31 CDT 2017


How is that better than this?

template = "This is the first line.\n" +
            "This is the second line.\n" +
            "This is the third line."

> On Apr 3, 2017, at 10:42 AM, Ricardo Parada via swift-evolution <swift-evolution at swift.org> wrote:
> 
> It look prettier without the \n
> 
> It's not laziness.
> 
> I want my code to look pretty.
> 
> 
>> On Apr 3, 2017, at 10:40 AM, Adrian Zubarev <adrian.zubarev at devandartist.com <mailto:adrian.zubarev at devandartist.com>> wrote:
>> 
>> What I was trying to say is that by automatically adding a new line character does not provide any benefit except of being lazy to type \n.
>> 
>> // In your model this would be equivalent
>> let s1 = "\n\n\n"
>> let s2 = """
>>     " // However in my model this is an empty string and should be banned
>>     "
>>     """ // That's also an empty string, but it that case it indicates the end of the multi lined string
>> I dislike the tradeoff of precision for laziness.
>> 
>> 
>> 
>> 
>> -- 
>> Adrian Zubarev
>> Sent with Airmail
>> 
>> Am 3. April 2017 um 16:29:44, Ricardo Parada (rparada at mac.com <mailto:rparada at mac.com>) schrieb:
>> 
>>> By the way, the multi-line string should allow \n\n, or as many as you may want to throw in there.  I don't see a problem with that.
>>> 
>> 
>> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170403/74f77210/attachment.html>


More information about the swift-evolution mailing list