It looks like we have different interpretations about what "literal" means (I 
think this may have been brought up in earlier messages in this thread; I don't 
remember the resolution). I interpreted it as meaning the same thing as literal 
in *LiteralConvertible, i.e., a Swift type that is written out in source. 
Multiline string literal would then refer to a multiline "piece of source code 
representing a String". It sounds like you are taking "literal" to mean 
something that *literally* (to the extent possible) represents its data, which 
in the case of String would mean writing out the source code exactly as the 
resulting String will appear. Up until now I think those two interpretations of 
"literal" were equivalent. For no type other than String is the physical layout 
in source related to the underlying data, and prior to this proposal the point 
was moot for String because there was only a single allowable layout (barring 
concatenation with +, which utilizes multiple independent literals).

So, my view of the goal of this proposal is to allow writing a 
StringLiteralType across multiple lines. It appears your view is to allow using 
multiple lines to *literally* represent a String's content.

Again, for editors that indent wrapped lines, disallowing manually breaking 
lines will actually introduce ambiguity into the multiline string, which runs 
counter to the goal of the proposal. Also, from an ideological standpoint I see 
no reason to disallow this feature.

-- Robert

> On Apr 21, 2017, at 2:48 PM, Xiaodi Wu <[email protected]> wrote:
> 
>> On Fri, Apr 21, 2017 at 1:45 PM, Erica Sadun <[email protected]> wrote:
>> 
>>> On Apr 21, 2017, at 12:40 PM, Xiaodi Wu via swift-evolution 
>>> <[email protected]> wrote:
>>> 
>>>> On Fri, Apr 21, 2017 at 8:48 AM, Robert Bennett via swift-evolution 
>>>> <[email protected]> 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. 
> 
> A different scenario from what Robert's describing, but sure. This goes to my 
> question to David Hart. Isn't this an argument for a feature to allow 
> breaking a single-line string literal across multiple lines? What makes this 
> a use case for some feature for _multiline_ string literals in particular?
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to