[fpc-pascal] FreePascal Coding style

Vinzent Hoefler JeLlyFish.software at gmx.net
Mon Jan 21 13:20:52 CET 2008


On Monday 21 January 2008 13:01, Graeme Geldenhuys wrote:
> On 21/01/2008, Vinzent Hoefler <JeLlyFish.software at gmx.net> wrote:
> > As an example where most tools just put out nonsense, consider this:
> > |type
> > |   CPU_Ins = (Add,  Sub, Mul, Div,
> > |              Jnz,  Jz,  Jnc, Jc,
> > |              Call, Ret,
> > |              Push, Pop,
> > |              ...);
>
> This is so easy to accomplish with 'elastic tabstops' (ET).

No, it ain't.

> ET is 
> all about keeping alignment of text in columns. Trailing comments,
> column in code like you shown above etc..Just watch the flash demo of
> ET or try the Java example (though a bit dated I believe).

I tried the Java example and the first thing which struck me was this:

|int someDemoCode(  int fred,
|                   int wilma)
                  ^^

To accomplish it's task of detecting tabular design, it inserts tabstops 
where no tabstops belong.

Tests:

1) If I remove the tab before "int fred", the "int wilma" is not even 
aligned anymore. Even worse.
2) If I put the tabstop "typographically correct" as it should be (that 
means: right before the parentheses)[1], it aligns "int wilma", but of 
course right after the tab stop, so it doesn't start below "int fred", 
but right below the parentheses. Wrong, again.

And that's what the Eclipse auto-formatter already did for years and the 
reason why we disabled it.
We simply came to the conclusion, that if we manually format with spaces 
we'll be typing faster, because we wouldn't have to fight the "tool" 
anymore.

Further, all this even bites with the "it only saves spaces". If it does 
in the end, then there's no way to detect where the tabs were supposed 
to be.

So, as I've mentioned already, that's another tool that fails the task. 
Not to mention, that I initially talked about automated tools, not 
mere "editor-plugins", that even seem to even fail on the first try to 
reload a saved file and display it the same as before I saved it.


Vinzent.

[1] In normal text( you don't write parentheses like that ), do you?



More information about the fpc-pascal mailing list