[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
Fri Jul 5 19:36:48 CEST 2019


On Fri, Jul 5, 2019 at 1:14 PM Ryan Joseph <genericptr at gmail.com> wrote:

> This may present a bit of problem then because you don't appear to be able
> to opt-in to long strings just for constants. $h+ will always be required
> for multi-line strings but I don’t want the rest of my “string” types to
> turn into ansistrings. Is there any solution to this?
>

I don't think it's really true that you'll *always* need long strings for
multi-line stuff, however, if you're concerned about this in general there
is in fact a way to switch between {$H+} and {$H-}:

program Example;

{$push}
{$H+}
var Ansi: String;
{$pop}
var Short: String;

begin
  WriteLn(GetTypeKind(Ansi));
  WriteLn(GetTypeKind(Short));
end.

which prints:

tkAString
tkSString

indicating they're the types you'd want / expect.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190705/97706dfa/attachment.html>


More information about the fpc-devel mailing list