[Lazarus] Auto indentation

waldo kitty wkitty42 at windstream.net
Thu Nov 5 22:14:07 CET 2009


Jürgen Hestermann wrote:
>> And that's kind of formatting that I don't like. My formatter would 
>> append dangling begins to the end of the preceding part of the 
>> statement. This is where the language syntax comes into play:
>> Pascal:
>> if a then BEGIN
>>   ...
>> END else BEGIN
>>   ...
>> END
> 
> 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. That makes it much easier to check if some of these keywords are 
> missing:

exactly... you've stated it better than i was going to...

> if a then
>    begin
>    xxxxx
>    .....
>    yyyyy
>    zzzzz
>    end;
> 
> To me BEGIN and END clamp a logical block (that is indented by 3 
> characters) so they need to be aligned with all commands of the same 
> level. Each next block of IF, WHILE, REPEAT etc. is indented again by 3 
> characters. By following this strict rule the code is much more readable 
> to me.


this is the way i was taught way back with Turbo Pascal 2 and 3... except that 
we were taught 2 spaces indenting for each sub-block... heck, i don't think i've 
ever touched the TAB key while coding anything except for some perl stuff a 
while back... for me, the TAB is to move from field to field in a spread sheet 
or database... that's the way i was taught and have worked for 30+ years...




More information about the Lazarus mailing list