- error handling?
Please expand.
Getting rid of the semicolon in Pascal is not a good idea. The reason is, a semicolon tells the compiler a statement has ended. Without the semicolon, the compiler has to figure out a statement has ended using context, that alone is likely not possible in all cases and, even if possible, it would complicate the compiler's code.
vtereshkov provided a good example of that in his last post. In the code:
var
a: integer = 1;
begin
case a of
1, 2: if a = 2 then
writeln(2);
else
writeln(1);
end;
end.
if there were no semicolons, how could the compiler decide if the "else" associates with the "if" or the "case" ?
Another example that comes to mind which I personally use all the time is this:
if somecondition then
{$IFDEF FORCE_CONDITION} ; {$ENDIF}
begin
<statements to handle the condition>
end;
that way I can ensure the code can handle the condition without having to create a test case for it, which in some cases can be very difficult and/or time consuming, to ensure the code works. By optionally inserting that semicolon after the "then" I can activate the code.
Spaces and newlines make for lousy separators.
Maybe that also gives an idea to those who put the "then" and "begin" keywords on the same line, why doing that is not a good idea either, nor good "style" for that matter.