[Lazarus] Auto indentation

Jürgen Hestermann juergen.hestermann at gmx.de
Fri Nov 6 07:18:58 CET 2009


>> And that's something *I* don't like. You never know which END belongs 
>> to wheach BEGIN. I always column align all ENDs to their corresponding 
>> BEGINs.
> You missed the second part of my argumentation. I'm thinking in the 
> superior Modula syntax, that does not require begin-end pairs around 
> statement sequences.

I am not sure why you mention the Modula syntax. I thought we are 
talking about Pascal here. And Pascal requires the begin-end pairs 
(unless it is a single statement). And there is a logic behind it. I 
always see directly which block is related to the IF (WHILE, REPEAT, 
...) statement:

-----------------
if a then
    begin
    xxxxxx;
    yyyyyy;
    ....
    zzzzzz;
    end;
aaaaa;
bbbbb;
ccccc;
-----------------

-----------------
if a then
    xxxxxx;
aaaaa;
bbbbb;
ccccc;
-----------------

And if the statement or block is very short I can put the whole on one line:

-----------------
if a then begin xxxxxx yyyyyy .... zzzzzz end;
aaaaa;
bbbbb;
ccccc;
-----------------

-----------------
if a then xxxxxx;
aaaaa;
bbbbb;
ccccc;
-----------------

I *never* put deeper level commands/blocks on the same column (including 
BEGIN/END) and I *always* align the BEGIN/ENDs. The BEGIN/ENDs delimit 
the block and are part of it so IMO they should be treated the same as 
all other commands of the block and be aligned with them.







More information about the Lazarus mailing list