[fpc-devel] Semicolon before else

Michael Van Canneyt michael at freepascal.org
Fri Jan 29 11:42:41 CET 2010



On Fri, 29 Jan 2010, Juha Manninen wrote:

>> Because FPC does not support semicolon before else :-)
>
> Ok, I remembered it connects to the first IF when there is semicolon.
> Apparently I remembered wrong...
>
> It means there is no ambiguity and the patch can be applied without breaking
> any code.
> Or, is there some detail I have missed?

It breaks the behavious of case:

case b of
   1 : something;
   2 : If a then
        DoSomethingElse;
else
   DoElse
end;

As it is now, b=2 and a=False will result in no code executed.

After the patch, B=2 and a=False will result in DoElse.

So _if_ this patch is to be applied, then it must be with an appropriate -S
command-line switch.

Personally, I don't see the adavantage of this patch.

I don't even understand why people see the current behaviour as problematic.
The syntax is unambiguous. You must type your code correct. 
The if then else statement is no exception to this rule.

One might as well ask that in written language, in some cases ? might be
written as ! because it uses less ink.
Go and propose that in a linguistic conference, see where it gets you...

Michael.



More information about the fpc-devel mailing list