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

wkitty42 at windstream.net wkitty42 at windstream.net
Sat Jul 6 22:50:07 CEST 2019


On 7/6/19 12:05 PM, Ben Grasset wrote:
> On Sat, Jul 6, 2019 at 11:51 AM Ryan Joseph <genericptr at gmail.com> wrote:
> 
>     You can of course shift the strings all the way to the left (which is ugly)
> 
> Is it though? I think it looks fine, personally, if you place the initial 
> backtick on the next line after the equal sign, like this:
> 
> const MultiLine =
> `Sentence one.
> Another sentence.
> A third sentence.
> A fourth sentence.
> A fifth sentence.`;

procedure foo
   procedure bar
     const MultiLine1 =
           `Sentence one.
            Another sentence.
            A third sentence.
            A fourth sentence.
            A fifth sentence.`;
           MultiLine2 = `Sentence one.
                         Another sentence.
                         A third sentence.
                         A fourth sentence.
                         A fifth sentence.`;
           MultiLine3 = `Sentence one.
Another sentence.
A third sentence.
A fourth sentence.
A fifth sentence.`;
     begin
       writeln("MultiLine1= '",MultiLine1,"'");
       writeln("MultiLine2= '",MultiLine2,"'");
     end;
   begin
     bar;
   end;
end;

?

just asking... can't test... the private procedure is specifically to exhibit 
various formats and to query what the output would be... intended output in this 
case is

'Sentence one.
Another sentence.
A third sentence.
A fourth sentence.
A fifth sentence.


> In general though I think that using indentation as an actual "argument" against 
> this is very strange (which I know you were not doing, to be clear.)

one person's PrettyPrint format is another's ugly-as-sin ;)


-- 
  NOTE: No off-list assistance is given without prior approval.
        *Please keep mailing list traffic on the list unless*
        *a signed and pre-paid contract is in effect with us.*


More information about the fpc-devel mailing list