Skip to content

Commit c586872

Browse files
authored
Merge pull request #25875 from Zirunis/patch-2
Update Style Guide to suggest TitleCase for Type aliases as is the reality in the standard library
2 parents f3309a9 + e1f1212 commit c586872

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

doc/langref.html.in

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7105,10 +7105,12 @@ coding style.
71057105
</p>
71067106
<ul>
71077107
<li>
7108-
If {#syntax#}x{#endsyntax#} is a {#syntax#}type{#endsyntax#}
7109-
then {#syntax#}x{#endsyntax#} should be {#syntax#}TitleCase{#endsyntax#}, unless it
7110-
is a {#syntax#}struct{#endsyntax#} with 0 fields and is never meant to be instantiated,
7111-
in which case it is considered to be a "namespace" and uses {#syntax#}snake_case{#endsyntax#}.
7108+
If {#syntax#}x{#endsyntax#} is a {#syntax#}struct{#endsyntax#} with 0 fields and is never meant to be instantiated
7109+
then {#syntax#}x{#endsyntax#} is considered to be a "namespace" and should be {#syntax#}snake_case{#endsyntax#}.
7110+
</li>
7111+
<li>
7112+
If {#syntax#}x{#endsyntax#} is a {#syntax#}type{#endsyntax#} or {#syntax#}type{#endsyntax#} alias
7113+
then {#syntax#}x{#endsyntax#} should be {#syntax#}TitleCase{#endsyntax#}.
71127114
</li>
71137115
<li>
71147116
If {#syntax#}x{#endsyntax#} is callable, and {#syntax#}x{#endsyntax#}'s return type is
@@ -7147,8 +7149,7 @@ const namespace_name = @import("dir_name/file_name.zig");
71477149
const TypeName = @import("dir_name/TypeName.zig");
71487150
var global_var: i32 = undefined;
71497151
const const_name = 42;
7150-
const primitive_type_alias = f32;
7151-
const string_alias = []u8;
7152+
const PrimitiveTypeAlias = f32;
71527153

71537154
const StructName = struct {
71547155
field: i32,

0 commit comments

Comments
 (0)