<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I feel discussion on this proposal is nearing general agreement that while the gist of it</div><div class="">it seems reasonable to many there is also not enough detail in it as submitted.</div><div class=""><br class=""></div><div class="">Brent has person-fully stepped in and rewritten the draft to translate it into a detailed</div><div class="">specification which I’ve updated here:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/johnno1962a/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md" class="">https://github.com/johnno1962a/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md</a></div><div class=""><br class=""></div><div class="">Perhaps we could use the remaining time on the review to pre-evaluate this draft should</div><div class="">we get the chance to resubmit with modifications to maximise its chances. Key questions:</div><div class=""><br class=""></div><div class=""><div class="">1) Does Swift need multi-line string literals?</div><div class="">2 ) Is “””long strings””” the way to go subject to a discussion about the precise delimiter</div><div class="">3) Is the “magic" leading whitespace removal a good idea to support indentation.</div></div><div class=""><br class=""></div><div class="">The main change on the revised proposal from the the original submitted is Thorsten’s</div><div class="">suggestion that Windows line endings in a source file be normalised to \n in the literal.</div><div class=""><br class=""></div><div class="">John</div><br class=""><div><blockquote type="cite" class=""><div class="">On 10 Apr 2017, at 12:09, Thorsten Seitz <<a href="mailto:tseitz42@icloud.com" class="">tseitz42@icloud.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">Am 09.04.2017 um 18:29 schrieb John Holdsworth <<a href="mailto:mac@johnholdsworth.com" class="">mac@johnholdsworth.com</a>>:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi, John here, the submitter of the proposal.</div><div class=""><br class=""></div><div class="">First up, I must apologise for putting Brent on the spot when I resubmitted this altered proposal from last year. That was my mistake.</div><div class=""><br class=""></div><div class="">Second up, apologies if the proposal is rather vague on details. In some sense this was intentional as I didn’t want to get too bogged down in specifics (and not at all to do with my limitations as a technical writer!)</div><div class=""><br class=""></div><div class="">I guess we need to build up consensus more slowly by asking the following questions separately so it can be resubmitted rather than giving a binary +/-1 on the proposal as it stands.</div><div class=""><br class=""></div><div class="">1) Does Swift need multi-line string literals?</div></div></div></blockquote><div class=""><br class=""></div>Yes.</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">2 ) Is “””long strings””” the way to go subject to a discussion about the precise delimiter</div></div></div></blockquote><div class=""><br class=""></div>Yes.</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">3) Is the “magic" leading whitespace removal a good idea to support indentation.</div></div></div></blockquote><div class=""><br class=""></div>Yes.</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">4) Does the proposal contain sufficient detail to be discussed/implemented</div></div></div></blockquote><div class=""><br class=""></div>Thanks for the update! I only have the following issues left:</div><div class=""><br class=""></div><div class="">> All other escapes would be processed as before including interpolation, \n and "</div><div class="">You probably meant \“ instead of " here.</div><div class=""><br class=""></div><div class="">The proposal should state what kind of newline will be used within a multiline string literal. I already proposed that it should be exactly the same as for \n and not the newline character(s) actually used in the file (e.g. LF+CR or LF or CR), to avoid issues when working on different platforms (Windows, Mac, Linux) and/or using Git’s autocrlf feature.</div><div class=""><br class=""></div><div class="">The proposal should give an example how to create a multiline string literal which ends with a newline (AFAIU there should be an empty line before the closing ""“).</div><div class=""><br class=""></div><div class="">-Thorsten</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">My answer to 1) is obviously yes and I think the discussion has come out about 50/50 so far so lets persevere...</div><div class=""><br class=""></div><div class="">Trying to fie down 2), a “””long string””” or @“long string”@ or _”long string”_ or #”long string”# is a string literal inside a new delimiter. It would be processed exactly as it would a normal string including escapes and interpolation except the string can include unescaped “ or “" and newlines. Also, a \ at the end of the line would mean that particular newline is not included in the string.</div><div class=""><br class=""></div><div class="">For me, the goals of a long string are that it should be able to pasted in (almost) without modification from a text source and that syntax highlighting would work for the widest possible range of text editors and github. “””long string””” is just a trick Python uses to satisfy the second goal (for example <a href="https://gist.github.com/johnno1962/5c325a16838ad3c73e0f109a514298bf#file-multiline-swift-L97" class="">this gist</a>) but highlighting also works for asymmetric delimiters such as @“long string”@ which avoid potential problems with “inversion”. Heredoc or a Swifty #equivalent does not satisfy this second goal at all well and IMHO it should be excluded. It would also be significantly more difficult to integrate into the Swift compiler.</div><div class=""><br class=""></div><div class="">Looking at 3) which is underspecified in the proposal perhaps, I’d consider it a “feature" but I can see it would be too magical for some. To specify it more you could say: if there is only whitespace between the last newline and the end of a multiline literal this whitespace will be stripped from all lines in the literal. If lines do not start with this exact sequence of whitespace a warning is emitted. In addition, if the first character in the literal is a newline it will be removed. This operation could be made explicit e.g. <font face="Menlo" class=""><span style="font-size: 11px;" class="">#trimLeft(“”"a literal""")</span></font></div><div class=""><br class=""></div><div class="">Perhaps we can find common ground on 1) and 2) and even 3) with a view to resubmitting if there is time. Seems mostly like we just need to discuss the delimiter further and decide whether the indent trimming is a bug or a feature to keep moving and not let another year slip by.</div><div class=""><br class=""></div><div class="">With respect to 4) I’m updating <a href="https://github.com/johnno1962a/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md" class="">https://github.com/johnno1962a/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md</a> as the proposal is discussed to fill in some of the gaps & I’ve prepared a toolchain for Swift 3 if you want to <a href="http://johnholdsworth.com/swift-LOCAL-2017-04-09-a-osx.tar.gz" class="">try an implementation out </a></div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On 9 Apr 2017, at 15:35, Thorsten Seitz via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0168-multi-line-string-literals.md</a></blockquote></div></div></blockquote><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">What is your evaluation of the proposal?</div></div></div></blockquote><div class=""><br class=""></div>+1</div><div class=""><br class=""></div><div class="">My foremost expectation from multiline string literals is to be able to copy and paste multiline string literals without having to fiddle with escape marks or leading and trailing quotes or continuation characters. This is exactly what the proposal provides and makes it easy to embed SQL, for example (using SQL parameters and not string interpolation of course ;-)</div><div class=""><br class=""></div><div class="">The chosen deindentation rules seem very pragmatic and useful to me.</div><div class=""><br class=""></div><div class="">Additional features for multiline string literals can be added easily later.</div><div class=""><br class=""></div><div class="">I would expect multiline string literals to use the same newline character as "\n“ does, regardless of the newline character actually used in the file.</div><div class="">Furthermore all normal escapes, e.g. \n, \t etc. should probably be available as well. </div><div class="">This should be stated explicitly in the proposal.</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">Is the problem being addressed significant enough to warrant a change to Swift?<br class=""></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Yes.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">Does this proposal fit well with the feel and direction of Swift?<br class=""></div></div></div></div></blockquote><div class=""><br class=""></div>Yes.</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br class=""></div></div></div></div></blockquote><div class=""><br class=""></div>For setting the ground it compares favourably.</div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br class=""></div></div></div></div></blockquote><br class=""></div><div class="">Followed most discussions, read the proposal.</div><div class=""><br class=""></div><div class="">-Thorsten</div><br class=""></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></body></html>