Forum > Suggestions

Simplifying compound control structures

<< < (2/2)

marcov:

--- Quote from: JackD on December 08, 2022, 11:02:30 am ---
--- Quote ---While the M2 syntax is mostly IMHO better, there is a reason this hasn't happened yet.

--- End quote ---

"yet"? So there is some hope, then?  :D

--- End quote ---

Yes, you can use Modula-2  :)

MarkMLl:

--- Quote from: JackD on December 08, 2022, 10:29:21 am ---More generally, I'm taking about dispensing with begin-end in control statements, as Wirth did with Modula-2 and Oberon. It makes for clearer and much more readable code which has a pleasing symmetry about it.

--- End quote ---

You need to take this in context. Pascal was a hurried derivative of ALGOL-W, which was syntactically close to ALGOL-60 where the rule was that an if statement (etc.) controlled a single subsequent statement. That form was also consistent with the if /expression/, which selected one of two possible subsequent expressions for evaluation.

The dangling-else issue was identified and fixed in ALGOL-68, and as a member of the committee Wirth cannot claim ignorance of both the issue and its solution.

There are two corollaries to this. The first is that if Wirth had had even minimal exposure to COBOL he should have realised how problematic the various declaration sections were, and the extent to which they were already derided. As such, I would argue that CONST, TYPE, VAR and the rest should similarly require a BEGIN-END if they applied to multiple declarations.

The second is that the extremely uncomfortable mix of styles in Pascal "as currently spoken", where an if statement /requires/ a BEGIN-END to govern more than one subsequent statement but a CASE-ELSE-END is self-closing, is largely Borland's doing. However it would be unfair to absolve Wirth of all responsibility, since RECORD-END and REPEAT-UNTIL are his responsibility.

The bottom line is that we've inherited a Godawful mess.

MarkMLl

PascalDragon:

--- Quote from: JackD on December 08, 2022, 10:29:21 am ---I have no idea how much work would be involved to implement this, and it's probably been suggested before, but I'm interested in responses.

--- End quote ---

Yes, such things have been suggested before and as before the answer will always be the same: there won't be any changes regarding this.

Navigation

[0] Message Index

[*] Previous page

Go to full version