[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] Issue with rename a function & compiler crash
From: |
Gaius Mulley |
Subject: |
Re: [Gm2] Issue with rename a function & compiler crash |
Date: |
Mon, 12 Mar 2018 11:20:17 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
"Fischlin Andreas" <address@hidden> writes:
> Dear all,
>
> AFAIK your interpretation is right.
>
> However, to make for once a comment on the bad habit of gm2
> programmers to NOT capitalize procedures and types is really a very
> big drawback of gm2. Just to say it once. 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.
>
> Regards,
> Andreas
>
> Cited References:
> ------------------------
> Keller, D., 1990. A guide to natural naming. ACM, 25: 95-102. doi:
> 10.1145/382080.382637 Ke183
>
Hi Andreas,
many thanks for pointing me in this direction. It is very timely as I
have to reformat the code for inclusion into the GCC tree (which I plan
to do over the summer). At the same time I'll convert the modules to
the above format one at a time. I'll adapt the GNU coding style
standard (based from C) to include the above and produce a proposed GNU
coding style standard for M2,
regards,
Gaius
- [Gm2] Issue with rename a function & compiler crash, Michael Riedl, 2018/03/10
- Re: [Gm2] Issue with rename a function & compiler crash, Gaius Mulley, 2018/03/10
- Re: [Gm2] Issue with rename a function & compiler crash,
Gaius Mulley <=
- Re: [Gm2] Issue with rename a function & compiler crash, Fischlin Andreas, 2018/03/12
- Re: [Gm2] Issue with rename a function & compiler crash, john o goyo, 2018/03/12
- Re: [Gm2] Issue with rename a function & compiler crash, Benjamin Kowarsch, 2018/03/13
- Re: [Gm2] Issue with rename a function & compiler crash, john o goyo, 2018/03/13
- Re: [Gm2] Issue with rename a function & compiler crash, Gaius Mulley, 2018/03/21
- Re: [Gm2] Issue with rename a function & compiler crash, Gaius Mulley, 2018/03/28