[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Identifier Naming

From: Benjamin Kowarsch
Subject: Identifier Naming
Date: Mon, 27 Mar 2023 17:58:52 +0900

On Mon, 27 Mar 2023 at 17:33, Fischlin Andreas wrote:

I use this opportunity to comment on another problem I have with gm2 given some sample code in this thread.

I wholeheartedly agree.
At the risk of repeating myself, strictly applying following capitalisation rules would make gm2 code much more readable:
  1. MODULE, TYPE, and PROCEDURE identifiers should always start with a capital
  2. CONST and VAR identifiers should start with a lower case. 
  3. PROCEDURE identifiers should be based on a verb
  4. TYPE identifier should be based on an adjective, adverb or a property describing noun.
A similar additional distinction for CONST and VAR identifiers as given by rules 3 and 4 does not exist but is less needed as semantically rarely of relevance in Modula-2.

It is always a good idea to decide on and write down a naming convention before starting to write the first line of code for any given project. Unless of course there is already an established and documented naming convention for the language itself, in which case it should probably be followed.

We did this for our project and it is part of the language specification document:

In addition to the naming convention, we also needed a coding standard to exclude the use of features that aren't portable between dialects and compilers since our bootstrap code has to be portable across dialects and compilers:

BTW, for me this is the biggest turn off from gm2 and its library.

Perhaps, GM2 could use a documented naming convention and coding standard, too.

Gaius, feel free to borrow. ;-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]