The semicolon is useless most of the time. Though sometimes, it makes a difference. So I am thinking that we could simply avoid these cases and remove the semicolon completely. It seems that many people agree, though we can make it a compiler option so that anyone is free to do as they want.
Here are the only uses we have found of the semicolon.
To do nothing if the test happens. But one could simply write in this rare case the follwing:
if sometest then begin end
Also for the loop, the same thing applies.
Another case, that is arguably more significant is the following:
var
a: integer = 1;
begin
case a of
1, 2: if a = 2 then
writeln(2);
else
writeln(1);
end;
end;
In this case, one can use the
otherwise keyword to avoid the ambiguity:
var
a: integer = 1
begin
case a of
1, 2: if a = 2 then
writeln(2)
otherwise
writeln(1)
end
end
What could help to transition towards a Pascal without semicolon would be to have a compiler switch to forbid the use of
else instead of
otherwise in a case statement and to forbid empty statements so that people would need to write
begin end in these rare occurences.
After that, we could transition to an optional semicolon, and then to remove it completely.
An exception could be kept though to have multiple statements on one line.
What do you think?