[fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.
Ben Grasset
operator97 at gmail.com
Thu Jul 4 15:07:02 CEST 2019
On Thu, Jul 4, 2019 at 1:32 AM Sven Barth via fpc-devel <
fpc-devel at lists.freepascal.org> wrote:
> const SomeString = `Whatever
> bar
> blubb
> foobar`;
>
You can do:
const SomeString =
`Whatever
bar
blubb
foobar`;
Not that I think the "ugliness" argument makes any sense whatsoever. I
regularly come across entire source files that are IMO formatted very
poorly. Do I think FPC should somehow detect that fact and not compile
them? No, of course not. Multiline strings, like everything in a source
file, are exactly what you write them as.
On Thu, Jul 4, 2019 at 1:46 AM J. Gareth Moreton <gareth at moreton-family.com>
wrote:
> It's a shame, because I like the feature in principle, but the
> whitespace problem is a bit of a deal-breaker for me.
There is no "problem." A string, again, *is exactly what you write it as.*
On Thu, Jul 4, 2019 at 1:46 AM J. Gareth Moreton <gareth at moreton-family.com>
wrote:
> Also, things like
> trailing spaces and the line terminators being either #10 or #10#13 may
> cause a lot of problems if the string has to be known exactly (e.g. for
> cryptographic hash generation).
This, which is IMO *still* a non-problem in the sense of it should
absolutely not be the compiler's duty to babysit and/or police line
people's *line endings*, would not even be "solved" by IncludeString as it
would still then depend on exactly how an editor *saves* the line endings.
Anyways, regardless of whatever bizarre nitpicky complaints people have
here and whether or not anyone wants to merge it into trunk, I fully intend
to keep developing this (already working, as I demonstrated!) feature and
make the patch available for anyone who does want to use it (which as far
as I can tell is a significantly-higher-than-zero number of people.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190704/1a9e1b60/attachment.html>
More information about the fpc-devel
mailing list