- A better block structure. Omits begin for all non procedure/function blocks, and makes END mandatory (also for one line blocks).
Wouldn't this make Modula-2 even more verbose than Pascal?
No, less. You lose way more begins than you gain ends. An "if then else" with begin..end blocks would keep just one end at the end, and you only lose a short end for every place where there is a single clause (usually after an IF).
But the nice part is that if you want to expand any block including onelines, you just can start typing, you don't have to insert a block first.
C programmers have a tendency to always use {}, and an M2 block is 3 or 4 characters (if you count the semicolon after END, C has no semicolon after }), so it is pretty close or the same (if you count e.g. the extra linefeed after the first { too if that is your style), but I like it more visually.
[/list]
IF condition THEN
statement1;
statement2
ELSE
statement3;
statement4
END;
And I liked it.
- inner modules (nested units), which more or less served as a information hiding building block within a module/unit.
Is this still necessary when most people use an IDE [Lazarus] to program?
One can argue if it was ever necessary, but the IDE doesn't change much. Using an IDE hasn't obsoleted other pure information hiding constructs as "private" either.
A controversial feature, but I think this could be a good idea.
However, I must add that I'll rarely need it...
I agree. I mentioned it for completeness, not because I'm a strong proponent of the feature.
- End 'procedurename' at the end of a block. A mixed blessing, made refactoring code more complicated, but "missing end" kind of errors were less confusing. I think a distinct procedural END is a good thing, but recycling the procedurename a bridge too far.
Is this still necessary when most people use an IDE [Lazarus] to program?
IDE/Lazarus has no influence. What might make it less needed is that the use of OO extensions make nested procedures not as common as they were. Still it improved the error handling in the case of missing ENDs, and narrowed its scope.
Pascal needs this harder than M2 even, because pascal accepts
[/list]
begin
begin
end;
end;
Which means that when you forget the END in some nested procedure, the outer procedures might be interpreted as such nested blocks, and the error will be on the next function or procedure line.
M2 suffers from this less, since BEGIN is only used for the procedure block. It would halt with an error on the first begin if it didn't have the end 'xx' extension.
I think IDE is something that makes this feature (and other forms of END disambiguation, BASIC style) easier because so many blocks are inserted by the IDE.
I used to have the stance that doing it at procedure ends is a good first order limitation of the scope, and BASIC was overkill. Nowadays I'm less sure. Maybe if I made a language myself I'd terminate some blocks (FOR, WHILE) too with the keyword (END FOR END WHILE)
As for coroutines, the examples that I have seen were mostly for background tasks, cooperative multitasking style. Afaik the Topspeed compiler came with a traffic light control example. But maybe Mark is right, and should I revisit the feature with newly gained knowledge of continuations.