To give an example, the discussed code should have been coded as follows:
MODULE Test ;
CONST
foo = Bar ;
PROCEDURE Bar (ch: CHAR) : CHAR ;
BEGIN
RETURN CAP (ch)
END Bar ;
VAR
ch: CHAR ;
BEGIN
ch := foo ('a')
END Test.
In general the rules used by M2 programmers at ETH Zurich since its invention are:
types Start always with upper case - use class names
constants and variables
Start always with lower case - noun or adjective + type name
function procedures
Start as procedures always with upper case - otherwise same rule as for variables
procedures (modules)
Start always with upper case - use a verb
One of the biggest advantages is that basic types can be deduced naturally from the identifier, since capitalized are types or procedures, but the latter use verbs (only exception are function procedures) while types use class names. Lower case identifiers
are a constant or variable, which can typically used interchangeably. These are the rules we have been following in general at ETH Zurich by all those programmers working in close collaboration with Niklaus Wirth and we never regretted following these rules.
It is a pity gm2 code has unfortunately AFAIK largely ignored these very helpful conventions. Some arguments are nicely discussed in Keller (1990), but we do not capitalize, e.g. constants, as Keller writes. But Keller (1990) nicely explains the philosophy
behind using nouns vs. verbs etc.
Cited References:
------------------------
Keller, D., 1990. A guide to natural naming. ACM, 25: 95-102. doi: 10.1145/382080.382637 Ke183