[Oberon] Identifiers and Capitalization
CFB Software
info at cfbsoftware.com
Thu Mar 16 00:28:39 CET 2006
> -----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.
The best way to encourage users to conform to a preferred style is
a) lead by example and be consistent
b) provide a Beautifier tool to help them
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp
More information about the Oberon
mailing list