[Oberon] Identifiers and Capitalization
August Karlstrom
fusionfive at comhem.se
Thu Mar 16 06:23:57 CET 2006
CFB Software wrote:
>>-----Original Message-----
>>From: oberon-bounces at lists.inf.ethz.ch
>>[mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of John Drake
>>Sent: Wednesday, 15 March 2006 8:57 AM
>>To: ETH Oberon and related systems
>>Subject: Re: [Oberon] Identifiers and Capitalization
>>
>>
>>Well the original convention avoided that
>>problem since variables and constants were
>>treated the same. (They start with lower
>>case). Perhaps this problem was the reason
>>for that convention?
>>
>
>
> That makes sense to me. It is also consistent with the 'Case' section of
> the programming conventions published by Oberon Microsystems for their
> BlackBox Component Pascal:
>
> --------------------------
> In general, each identifier starts with a small letter, except . A
> module name always starts with a capital letter . A type name always
> starts with a capital letter . A procedure always starts with a capital
> letter, this is true for procedure constants, types, variables,
> parameters, and record fields.
>
> Good
> null = 0X;
> DrawDot = PROCEDURE (x, y: INTEGER);
> PROCEDURE Proc (i, j: INTEGER; Draw: DrawDot);
>
> Bad
> NULL = 0X;
> PROCEDURE isEmpty (q: Queue): BOOLEAN;
> R = RECORD
> draw: DrawDot
> END;
>
> Don't use all-caps identifiers with more than one character. They should
> be reserved for the language.
> --------------------------
>
> Missing from both Mossenbock's and OMS's definitions (maybe assumed to
> be obvious) is the additional recommendation that the first letter of
> the second and subsequent words of a multiword identifier are also
> capitalised.
>
> Good
> DrawDot, toPage, topAge
>
> Bad
> Drawdot, topage
>
> I have been using these conventions for a while and have found them
> useful.
There is one additional rule I found in the .NET coding conventions
which i find sensible: If an acronym consists of two letters, write it
in all upper case or all lower case depending on what kind of identifier
it is a part of, otherwise treat it as a regular word.
Examples:
XmlSchema xmlSchema BTExpress btExpress
August
More information about the Oberon
mailing list