[fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

Marcus Sackrow alb42 at web.de
Wed Jul 3 20:21:32 CEST 2019


Am 03.07.19 um 18:53 schrieb Ben Grasset:
> On Wed, Jul 3, 2019 at 10:22 AM Marcus Sackrow <alb42 at web.de
> <mailto:alb42 at web.de>> wrote:
>
>     I use an operator overload(not for constants but inside the code)
>     because I'm used to our script engine have the '/' as operator for
>     strings as line break.
>
>
> 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.
> For really short stuff like your writeln example, also, it's not much
> different from just doing the following, which is already supported:
>
> writeln('1st line'#13#10'second line');
>
> or
>
> writeln('1st line'#10'second line');
>
> 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.
>

Sure I meant with that, if a new scheme would be introduced to make
multiline strings easier, i would prefer such operator, then as real
compiler operator also for constants and so on. Mine is just a
workaround. (the operator would also automatically select the right line
ending, mabye defined together with decimalseparator in formatsettings)

real multiline strings, I do not like, because they look ugly in a well
indented code... so your initial example taken would have an awful lot
of spaces in front of all lines, exept the first one.


Greetings,

Marcus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190703/70cab720/attachment.html>


More information about the fpc-devel mailing list