3
3
<!-- vim-markdown-toc GFM -->
4
4
5
5
* [ Capitalization Conventions] ( #capitalization-conventions )
6
- * [ Rationale] ( #rationale )
6
+ * [Rationale](#rationale)
7
7
* [ Word Choice] ( #word-choice )
8
- * [ Rationale] ( #rationale-1 )
8
+ * [Rationale](#rationale-1)
9
9
* [ Naming Type Members] ( #naming-type-members )
10
- * [ Rationale] ( #rationale-2 )
10
+ * [Rationale](#rationale-2)
11
11
* [ Layout Conventions] ( #layout-conventions )
12
- * [ Rationale] ( #rationale-3 )
12
+ * [Rationale](#rationale-3)
13
13
* [ Commenting Conventions] ( #commenting-conventions )
14
- * [ Rationale] ( #rationale-4 )
14
+ * [Rationale](#rationale-4)
15
15
* [ Language Guidelines] ( #language-guidelines )
16
- * [ Rationale] ( #rationale-5 )
16
+ * [Rationale](#rationale-5)
17
17
18
18
<!-- vim-markdown-toc -->
19
19
@@ -34,17 +34,17 @@ you must not rely on case differences in identifiers due to this.
34
34
Capitalize the first letter of each word in an identifier. Acronyms over 2
35
35
characters in length are considered whole words, so for instance prefer
36
36
` 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 ` .
38
39
39
40
For identifiers of parameter names and local scope variables do not capitalize
40
41
the first word. In these cases, prefer ` xmlWidget ` over ` XmlWidget ` or
41
42
` ioStream ` over ` IOStream ` . The same for acronyms of one character, so ` typeF `
42
43
over ` TypeF ` or ` nChars ` over ` NChars ` . (Note that the former two are malformed
43
44
names, however. See the "Word Choice" section for more information.)
44
45
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.
48
48
49
49
Argument names in base archive methods may be renamed, but arguments with
50
50
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
71
71
insensitivity, but we apply these rules to make reading easier and more
72
72
consistent with most other programming languages that have existed.
73
73
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
76
76
extended to static arrays for consistency.
77
77
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
+
78
83
## Word Choice
79
84
80
85
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
128
133
literally applicable. Prefer for instance ` Stop ` , ` Drop ` , ` Halt ` .
129
134
130
135
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 ` .
135
140
136
141
### Rationale
137
142
0 commit comments