Am 04.07.2019 um 01:57 schrieb J. Gareth Moreton:
While I like the idea in principle, one thing that I'm a bit worried
about is how whitespace is handled, like what counts for a leading or
trailing space in the string when between lines, since Pascal parsers
(and those for many other languages) traditionally, I believe, discard
everything following the last non-whitespace character in a line.
Also, with the backtick suggestion, what should one do if they wish to
include a control character (e.g. a linefeed) or the backtick
character itself?
Whitespace is indeed an important point. I myself pay quite some
attention to nice identation and with multiline strings that will
probably break:
=== code begin ===
const SomeString = `Whatever
bar
blubb
foobar`;
=== code end ===
That's how I also inline my normal multiline strings that I separate
with sLineBreak. However to get the same result with this proposed new
feature I'd have to do this:
=== code begin ===
const SomeString = `Whatever
bar
blubb
foobar`;
=== code end ===
Which looks just ugly.
And let's not forget that such strings can also be used inside code
sequences, cause it wouldn't make sense to restrict them just to constants:
=== code begin ===
var
s: string;
begin
if somecondition then
s := `Some
Multiline
String`
else
s := `Some
other
Multiline
String`;
end.
=== code end ===
Even if one would say that the whitespace at the start of a line is
discarded that wouldn't make everyone happy, cause then code like the
example Ben showed in his mail from today wouldn't work:
=== code begin ===
const Help = `Help:
-h:
Show this help.
-i:
Print the letter i for no reason.
`;
=== code end ===
So yes, I'm still against this feature.
Regards,
Sven
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel