Rami
Rami

Reputation: 61

In Algol 68 , what readability problems can come from with using reversed closure words for control structures?

like in Algol 68 an if statement ends with fi and a case statement ends with esac , so what are some readability problem other than the reserved words doesn't really make sense in English.

Any suggestions would be appreciated

Upvotes: 0

Views: 847

Answers (2)

user13784117
user13784117

Reputation: 1132

What readability issues? None.

The 'bracketing' approach removes ambiguity that is otherwise resolved by fiat.

For example, in the syntax of Algol 60, in

 if B1 then if B2 then S2 else S3

it is ambiguous which 'then' the 'else' pairs with; is it effectively like this?

 if B1 then begin if B2 then S2 else S3 end

or like this?

 if B1 then begin if B2 then S2 end else S3

To resolve the problem, there is an explicit rule saying it's the former case. That simply is not a problem in Algol 68. The two cases are syntactically distinct.

 if B1 then if B2 then S2 else S3 fi fi

and

 if B1 then if B2 then S2 fi else S3 fi

This is no harder to read than the use of parentheses in arithmetic expressions to determine the meaning.

Languages such as C and Java, which have regressed to the 'begin/end' style (through written as braces { }) suffer in readability by comparison.

Upvotes: 0

Will Hartung
Will Hartung

Reputation: 118764

There's not really a readability problem, it's simply something you get used to, and after some experience the problems falls out of the process. Similar to how many Lisp users "don't see" the parentheses. They simply don't stand out in the general case for the experienced reader.

You have to recall the time of Algol, notably the "68" part, as in 1968.

The bright side of the fi, esac, and od is that they clearly indicate what kind of block they're terminating, and they do it with a single token.

esac is no less clear than }, which is a meaningless bracket until you know otherwise. The {} have the benefit of consistency, while less wordy than Pascals begin - end generic block sequence.

Finally, consider how dominant the English language is in computer language design, and while folks who don't speak english may have some initial issues with the languages, that clearly passes over time.

So, it's a short hurdle that falls away quickly with use.

Upvotes: 3

Related Questions