<div dir="ltr"><div dir="ltr">On Wed, Jul 3, 2019 at 10:22 AM Marcus Sackrow <<a href="mailto:alb42@web.de">alb42@web.de</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I use an operator overload(not for constants but inside the code)<br>
because I'm used to our script engine have the '/' as operator for<br>
strings as line break.<br></blockquote><div><br></div><div>That's certainly a neat use of operator overloading! However, I think that it is still rather less clean/readable than what would be possible with "true" unbroken multiline strings.</div><div>For really short stuff like your writeln example, also, it's not much different from just doing the following, which is already supported:</div><div><br></div><div>writeln('1st line'#13#10'second line');</div><div><br></div><div>or</div><div><br></div><div>writeln('1st line'#10'second line');</div><div><br></div><div>BTW, doing it with an operator like that introduces quite a bit of additional overhead, as the concatenation is no longer done at compile time.</div><div><br></div><div><a href="https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(j:1,lang:pascal,source:'unit+output%3B%0A%0A%7B$mode+ObjFPC%7D%7B$H%2B%7D%0A%0Ainterface%0A%0Aoperator/(const+a,+b:+string):+string%3B+inline%3B%0Aprocedure+TestMultiLine%3B%0A%0Aimplementation%0A%0Aoperator/(const+a,+b:+string):+string%3B%0Abegin%0A++Result+:%3D+a+%2B+%2313%2310+%2B+b%3B%0Aend%3B%0A%0Aprocedure+TestMultiLine%3B%0Avar%0A++MultiLineString:+string%3B%0Abegin%0A++MultiLineString+:%3D%0A++++!'this!'/%0A++++!'is!'/%0A++++!'a!'/%0A++++!'multiline!'%3B%0A++//+or+even+shorter:%0A++MultiLineString+:%3D+!'this!'/!'is!'/!'a!'/!'multiline!'%3B%0Aend%3B%0A%0Aend.'),l:'5',n:'0',o:'Pascal+source+%231',t:'0')),k:41.17647058823529,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((h:compiler,i:(compiler:fpc304,filters:(b:'0',binary:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'1',intel:'0',libraryCode:'1',trim:'1'),lang:pascal,libs:!(),options:'-O3+-Ci-+-Cr-+-g-+-CX+-XXs',source:1),l:'5',n:'0',o:'x86-64+fpc+3.0.4+(Editor+%231,+Compiler+%231)+Pascal',t:'0')),k:58.82352941176471,l:'4',n:'0',o:'',s:0,t:'0')),l:'2',n:'0',o:'',t:'0')),version:4">Look at the assembler output here to get an idea.</a></div><div><br></div><div>After thinking about it more though I think Michael's backtick suggestion might actually be the best way to go, because of the fact that backticks currently have <b>no </b>meaning at all in Pascal, and as such, the compiler could safely directly and immediately assume that any use of them was specifically either the opening or closing of a multiline string.</div></div></div>