[swift-evolution] [Accepted] SE-0168: Multi-Line String Literals

Erica Sadun erica at ericasadun.com
Fri Apr 21 13:45:13 CDT 2017


> On Apr 21, 2017, at 12:40 PM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> 
> On Fri, Apr 21, 2017 at 8:48 AM, Robert Bennett via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> Xiaodi, I think one thing you're neglecting is that users may never print out a multiline literal string at all. A string might never be printed or read by a human outside of the code it resides in. In this case it seems perfectly reasonable to ask that it be possible to format the string nicely in the code and disregard how it would actually be printed.
> 
> Can you give an example of such a use case, where a string is never seen by a human but one cannot insert literal newlines and would need elided ones instead?

The most common reason is that the code is maintained by a (non-human) developer, who wants to be able to see and update the code in a readable form, but that represents a single line that will automatically wrapped by, for example, a UITextView for (human) consumption. 

-- E


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


More information about the swift-evolution mailing list