Naming Conventions
TADS 3's standard libraries follow a naming convention
similar to that used for the Java system classes. For consistency, the intrinsic function name and intrinsic class
method definitions provided with the compiler follow this same set of
conventions. Here's a summary of the
naming rules:
- All
identifiers except manifest constants ("#define" symbols)
use mixed-case letters. After the initial
letter, small letters are used, except that if an identifier consists of
more than one word, the first letter of each additional word is
capitalized. It is not necessary
to capitalize the first letter of an embedded word in a few cases, such as
when the pair of words could reasonably be rendered in ordinary writing as
a compound word or with a hyphen (for example, "sublist" could
be used rather than "subList").
- A
class name starts with a capital letter.
- Any
other identifier (function, method, property, object instance) starts
with a small letter.
- Manifest
constants are rendered in all capitals.
Underscores separate multiple words.
- When a
group of manifest constants is defined, such as an enumerated set of flag
values for a function argument, the group should use a common prefix to
emphasize the grouping. The prefix
should not itself contain an underscore and should be followed by an
underscore. (For example,
INFILE_OPEN and INFILE_SAVE for inputFile() flags.)
Note that the intrinsic functions don't adhere to these
rules quite perfectly. In particular,
the names of the regular expression functions (rexMatch, rexSearch, etc.) are
slightly irregular in that the "rex" prefix is an abbreviation for "regular
expression." Spelling out the
prefix as "regularExpression" or even "regEx" makes the
names too long, though, so the shorter prefix is used in the hope that it is
sufficiently clear and not too jarringly inconsistent with the rest of the
naming scheme.