Skip to content

Commit 8af513a

Browse files
committed
feat(docs)!: change naming convention for C++ types: lower_snake -> Upper_Snake
I don't like lower_snake_case for C++ types. It is hard to read for newcomers and sometimes forces awkard naming of local variables and member variables. Change the convention of types to Upper_Snake_Case. BREAKING CHANGE: A lot of code will need to be updated. These changes will come in several patches later.
1 parent 98c0e76 commit 8af513a

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

docs/architecture/ADR018-Naming-style.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ADR018: Naming style
22

3-
**Status**: Accepted and active.
3+
**Status**: Accepted and active; pending migration.
44

55
## Context
66

@@ -14,10 +14,10 @@ quick-lint-js uses the following styles for C++ code based on the C++ standard
1414
library's naming conventions:
1515

1616
* types
17-
* classes: `lower_snake_case`
18-
* enums: `lower_snake_case`
19-
* type aliases: `lower_snake_case`
20-
* type template parameters: `UpperCamelCase`
17+
* classes: `Upper_Snake_Case` (previously: `lower_snake_case`)
18+
* enums: `Upper_Snake_Case` (previously: `lower_snake_case`)
19+
* type aliases: `Upper_Snake_Case` (previously: `lower_snake_case`)
20+
* type template parameters: `Upper_Snake_Case` (previously: `UpperCamelCase`)
2121
* values
2222
* local variables: `lower_snake_case`
2323
* global variables: `lower_snake_case`
@@ -26,7 +26,7 @@ library's naming conventions:
2626
* private: `lower_snake_case_` (trailing underscore)
2727
* enum members: `lower_snake_case`
2828
* parameter variables: `lower_snake_case`
29-
* variable template parameters: `UpperCamelCase`
29+
* variable template parameters: `lower_snake_case` (previously: `UpperCamelCase`)
3030
* functions
3131
* free functions: `lower_snake_case`
3232
* class methods: `lower_snake_case`
@@ -38,11 +38,18 @@ library's naming conventions:
3838

3939
## Consequences
4040

41-
Because types and values have the same naming convention, we are sometimes
42-
forced to either qualify a variable's type or choose an inferior name. For
43-
example:
41+
Previously, because types and values have the same naming convention, we are
42+
sometimes forced to either qualify a variable's type or choose an inferior name.
43+
For example:
4444

4545
```c++
4646
quick_lint_js::output_format output_format =
4747
quick_lint_js::output_format::default_format;
4848
```
49+
50+
This issue has been fixed in an update to this ADR. The code can now be more
51+
succinct:
52+
53+
```c++
54+
Output_Format output_format = Output_Format::default_format;
55+
```

0 commit comments

Comments
 (0)