<div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">That's my point. You start with a little two-line string and when you see you have those all over your code. A feature is never bad but a feature that may be misused creates temptation to go for bad programming practices, like "I'm using it just this once" and once you're there you never stop.</div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif"><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">You can still have multiline string in Swift by concatenating strings as you already pointed but that discourages you from having too many lines glued like this. The approach of loading them from a file makes the code cleaner to read and the string cleaner to maintain and not having the means to have the lines in your code will push you to do the right thing and load them from a file from start.</div><div class="gmail_extra"><div><div class="gmail_signature"><div dir="ltr"><br></div></div></div>
<br><div class="gmail_quote">On 13 May 2016 at 01:16, Ricardo Parada <span dir="ltr"><<a href="mailto:rparada@mac.com" target="_blank">rparada@mac.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>I don't think the intent of multi-line string literals is to replace files or templating libraries. I use those all the time and are superior. </div><div><br></div><div><span style="background-color:rgba(255,255,255,0)">I think it would be handy and make it more pleasant to use for simple cases. </span></div><div><span style="background-color:rgba(255,255,255,0)"><br></span></div><div>Who has not run into a little multi-line literal in your code where you concatenate the pieces using +, add \n at the end of each line and have to escape quotes?<br><br></div><div><br>On May 12, 2016, at 12:36 PM, Leonardo Pessoa <<a href="mailto:me@lmpessoa.com" target="_blank">me@lmpessoa.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div style="font-family:trebuchet ms,sans-serif">I'm not in favour of multiline strings. I believe such strings should be stored in plain files and loaded as needed. It makes both the code and the string cleaner to read and maintain. I've had experiences with many languages that offer that resource and I could see what your code can become in terms of maintainability when you have such feature on the language.</div><div style="font-family:trebuchet ms,sans-serif"><br></div><div style="font-family:trebuchet ms,sans-serif">-1 from me.</div></div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr">- Leonardo</div></div></div>
<br><div class="gmail_quote">On 12 May 2016 at 01:05, Eduardo Mourey Lopez Ne via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Something like this might work</div><div><br></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span>//string ends on the first line that doesnt start with a "</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:rgb(0,0,0)">foo( </span><font color="#b51a00"><span>@</span><span>"<?xml version="</span><span>1.0</span><span>"?></span></font></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><font color="#b51a00"> "<catalog></font></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><font color="#b51a00"><span> </span><span>" <book id="</span><span>bk101</span><span>" empty="</span><span>"></span></font></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><font color="#b51a00"> " <author>\(author)</author></font></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><font color="#b51a00"> " <title>XML Developer's Guide</title></font></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><font color="#b51a00"> " <genre>Computer</genre></font></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><font color="#b51a00"> " <price>44.95</price></font></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><font color="#b51a00"> " <publish_date>2000-10-01</publish_date></font></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><font color="#b51a00"> " <description>An in-depth look at creating applications with XML.</description></font></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><font color="#b51a00"> " </book></font></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><font color="#b51a00"> "</catalog>\n</font></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> )</span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><br></span></div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><div style="margin:0px;line-height:normal;color:rgb(0,132,0)"><span>//additionally using a +" could be used to indicate a line break</span></div><div style="margin:0px;line-height:normal"><span><div style="margin:0px;line-height:normal"><span style="color:rgb(0,0,0)">foo( </span><font color="#b51a00"><span>@</span><span>"<?xml version="</span><span>1.0</span><span>"?></span></font></div><div style="margin:0px;line-height:normal"><span><font color="#b51a00"> +"<catalog></font></span></div><div style="margin:0px;line-height:normal"><font color="#b51a00"><span> +</span><span>" <book id="</span><span>bk101</span><span>" empty="</span><span>"></span></font></div><div style="margin:0px;line-height:normal"><span><font color="#b51a00"> +" <author>\(author)</author></font></span></div><div style="margin:0px;line-height:normal"><span><font color="#b51a00"> +" <title>XML Developer's Guide</title></font></span></div><div style="margin:0px;line-height:normal"><span><font color="#b51a00"> +" <genre>Computer</genre></font></span></div><div style="margin:0px;line-height:normal"><span><font color="#b51a00"> +" <price>44.95</price></font></span></div><div style="margin:0px;line-height:normal"><span><font color="#b51a00"> +" <publish_date>2000-10-01</publish_date></font></span></div><div style="margin:0px;line-height:normal"><span><font color="#b51a00"> +" <description>An in-depth look at creating applications with XML.</description></font></span></div><div style="margin:0px;line-height:normal"><span><font color="#b51a00"> +" </book></font></span></div><div style="margin:0px;line-height:normal"><span><font color="#b51a00"> +"</catalog>\n</font></span></div><div style="color:rgb(0,0,0);margin:0px;line-height:normal"><span> )</span></div><div style="color:rgb(0,0,0);margin:0px;line-height:normal"><span><br></span></div></span></div></span></div><div><div><div><blockquote type="cite"><div>On May 11, 2016, at 9:48 PM, Ricardo Parada via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><div><br><br>On May 11, 2016, at 2:34 PM, Vladimir.S <<a href="mailto:svabox@gmail.com" target="_blank">svabox@gmail.com</a>> wrote:<br><br><blockquote type="cite"><blockquote type="cite">For example:<br><br><br>letsourceCode =@“NSString *firstName = @“John”;<br> "NSString *lastName = @“Doe”;<br> “NSString *fullName = [NSString stringWithFormat: @“%@<br>%@“, firstName, lastName];"@<br><br>The one that would be a bit of a problem is the closing delimiter,<br></blockquote><br>Yes.. this is why I asked about `"@` - closing delimiter<br>so.. what is the solution in your case ?<br></blockquote><br>Hi Vladimir,<br><br>I don't really have a solution. Perhaps escaping the closing delimiter like this \"@<br><br>It is not pretty but I can't think of anything else. I imagine the other alternatives, i.e. the triple quote `"""` and the quote plus underscore `"_ ` have the same problem. <br><br>If we make the continuation quote required then we don't need a closing delimiter. That would solve the problem. But I've seen several people say they don't like the continuation quote because they want to be able to paste text and not have to worry much about formatting it afterwards. <br>_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></div></blockquote></div><br></div></div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>
</div></blockquote></div></blockquote></div><br></div></div>