From: Jürgen Hestermann [mailto:[email protected]] 
Sent: 26 May 2010 06:07

>> waldo kitty schrieb:
>> two spaces indention for each new section, not one or more than
>> 2 and most definitely not tabs...
>
>I find 3 spaces much more readable.
>
>> for example:
>> begin
>>   if foo then
>>     begin
>>       bar := foo;
>>       foo := not foo;
>>     end;
>>   if bar then
>>     begin
>>       foo := bar;
>>       bar := not bar;
>>     end;
>> end.
>
>But why have an indentation after BEGIN? There is no new block to start after 
>BEGIN. I would 
>indent like this:
>
>begin
>if foo then
>   begin
>   bar := foo;
>   foo := not foo;
>   end;
>if bar then
>   begin
>   foo := bar;
>   bar := not bar;
>   end;
>end.
>
>You immediately see that there are two IF statements within the program block. 
>If you indent 
>after BEGIN too, then this is not so obvious (to me). 
>
>Ok, in the end it may be all a matter of what you are used to.
> 
>> similar for var, const, and type declarations, too... always two spaces...
>
>Agree.
>

I've worked in a number of places which have different styles, my personal pref 
is with waldo kitty. Whilst I see where you are coming from in your 
indentation, if you indent as waldo suggests certain bugs or compilation issues 
can be more immediately apparent - do the begins & end match up? It's difficult 
to see when they are at the same level as the rest of the code.

Some places I've been like the begins to be inline with a conditional/loop 
declaration/etc, but I've never liked that. With one (large multinational) 
Their chosen style for if/elseif/else was:
if x then begin
  code
end else if y then begin
  code
end else begin
  code
end;
Which I found to be as helpful as a ice teapot, as scanning down you see one if 
with three ends and no context for what was happening in between..

Anyway, having seen the screenshot that Vladimir put up, I quite like it (not 
using a terribly uptodate version at the mo, whilst some pascal dev is on 
hiatus). I would opt for it being on (I know it's a quiet voice in a sea of 
no!), and bold wouldn't be a bad idea, or just another distinctive colour.

:shrug:

Duncan

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to