Well I hope the pascal language is updated so semicolons become required for end's.

Take a long hard look at the P4 or P5 code and you will find a lot of if then else statements with wrong identation as well, this makes it somewhat hard to understand which else belongs to which if, it also makes it somewhat more hard to fix the situation by adding begin end blocks and it makes the code less suited for editing which is a bit drawback.

But always writing end; the code is more easily editable because it will become more robust.

In the example you posted if an else is pasted right after the end it would be valid while that was perhaps not it's intention... and it would confuse the rest as well.

I think P4 and P5 code is a perfect example of confusion and such ;)

Now one could claim that it's my lack of understanding of the pascal language.

But then ask yourself on question: Why does Delphi's source beautifier have problems with it ? Why does Jedi Code Formatter have problems with it ?

Apperently I am not the only pascal/delphi programmer in the world which gets confused by the P4 and P5 code ! ;)

Definelty warrents further investigation into all this matter ;) not only the source beautifiers by free pascal and delphi compiler itself as well.

Here is an very nice experiment for you pascal compiler writes.

Do as I say and make end without a semicolon an error if it's not followed by an else.

This will probably immediatly make apperent where there are all kinds of sloppy programming sections in P4 and P5.

Also code like:

if a < b then SomeStatement
   else
       SomeStatement

if b > a then SomeOtherStatement
  else AnotherStatement

^ Notice not a single semicolon

Apperently it's completely legal to write code like this... but I consider it quite bad.

Bye,
Skybuck.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to