Skip to content

Commit 6a1c232

Browse files
committed
update style guide
1 parent 11b4e63 commit 6a1c232

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

glossary/Style.md

+21-16
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
<!-- vim-markdown-toc GFM -->
44

55
* [Capitalization Conventions](#capitalization-conventions)
6-
* [Rationale](#rationale)
6+
* [Rationale](#rationale)
77
* [Word Choice](#word-choice)
8-
* [Rationale](#rationale-1)
8+
* [Rationale](#rationale-1)
99
* [Naming Type Members](#naming-type-members)
10-
* [Rationale](#rationale-2)
10+
* [Rationale](#rationale-2)
1111
* [Layout Conventions](#layout-conventions)
12-
* [Rationale](#rationale-3)
12+
* [Rationale](#rationale-3)
1313
* [Commenting Conventions](#commenting-conventions)
14-
* [Rationale](#rationale-4)
14+
* [Rationale](#rationale-4)
1515
* [Language Guidelines](#language-guidelines)
16-
* [Rationale](#rationale-5)
16+
* [Rationale](#rationale-5)
1717

1818
<!-- vim-markdown-toc -->
1919

@@ -34,17 +34,17 @@ you must not rely on case differences in identifiers due to this.
3434
Capitalize the first letter of each word in an identifier. Acronyms over 2
3535
characters in length are considered whole words, so for instance prefer
3636
`XmlWidget` over `XMLWidget` but `IOStream` over `IoStream`. Acronyms of one
37-
character also count, so prefer `PrintF` over `Printf`.
37+
character also count, so prefer `PrintF` over `Printf`. Members with `m`
38+
prefixes in unmodifiable code must not capitalize the `m`.
3839

3940
For identifiers of parameter names and local scope variables do not capitalize
4041
the first word. In these cases, prefer `xmlWidget` over `XmlWidget` or
4142
`ioStream` over `IOStream`. The same for acronyms of one character, so `typeF`
4243
over `TypeF` or `nChars` over `NChars`. (Note that the former two are malformed
4344
names, however. See the "Word Choice" section for more information.)
4445

45-
Identifiers used for flags (declared with `flagdef`) and constants (declared
46-
with `const`, `static const`, or `enum`) must be all uppercase, except the `b`
47-
prefix on flags, and can separate words with underscores.
46+
Constants (declared with `const`, `static const`, or `enum`) must be all
47+
uppercase, and must separate words with underscores.
4848

4949
Argument names in base archive methods may be renamed, but arguments with
5050
defaults may not be renamed as they are part of the API.
@@ -71,10 +71,15 @@ written advocate for this. The purpose in ZScript is primarily moot due to case
7171
insensitivity, but we apply these rules to make reading easier and more
7272
consistent with most other programming languages that have existed.
7373

74-
Capitalizing constants, enumerations, and flags is an artifact of the way they
75-
are declared in ZDoom, and also in the original Linux Doom source code. This is
74+
Capitalizing constants and enumerations is an artifact of the way they are
75+
declared in ZDoom, and also in the original Linux Doom source code. This is
7676
extended to static arrays for consistency.
7777

78+
Flags were capitalized in Linux Doom due to being constants, and internally
79+
within ZDoom they are still constants, but due to the style of ZScript using
80+
full capitalization appears inconsistent. This is especially true due to the
81+
use of `m` prefixes in places within ZScript's standard library.
82+
7883
## Word Choice
7984

8085
In new identifiers, do not add underscores anywhere within the identifier,
@@ -128,10 +133,10 @@ mod. Avoid violent words such as `Die`, `Destroy`, `Kill`, except where
128133
literally applicable. Prefer for instance `Stop`, `Drop`, `Halt`.
129134

130135
Always name members with nouns, noun phrases or adjectives. Boolean values
131-
should often be prefixed with `Is`, `Has`, and other existential present-tense
132-
verbs. All members of class types should be prefixed with `m_`, despite rules
133-
against Hungarian notation and underscores. Try to name members productively
134-
rather than vaguely, instead of `RefInt` write `RefCount`.
136+
should often be prefixed with `Is`, `Has`, `Can`, and other existential
137+
present-tense verbs. All members of class types should be prefixed with `m_`,
138+
despite rules against Hungarian notation and underscores. Try to name members
139+
productively rather than vaguely, instead of `RefInt` write `RefCount`.
135140

136141
### Rationale
137142

0 commit comments

Comments
 (0)