Apply naming conventions of structs to files

master
Isaac Freund 2020-05-02 23:28:44 +02:00
parent 03a7124543
commit 3a397795be
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
1 changed files with 8 additions and 0 deletions

View File

@ -9990,6 +9990,13 @@ coding style.
conventions. conventions.
</p> </p>
<p> <p>
File names fall into two categories: types and namespaces. If the file
(implicity a struct) has top level fields, it should be named like any
other struct with fields using {#syntax#}TitleCase{#endsyntax#}. Otherwise,
it should use {#syntax#}snake_case{#endsyntax#}. Directory names should be
{#syntax#}snake_case{#endsyntax#}.
</p>
<p>
These are general rules of thumb; if it makes sense to do something different, These are general rules of thumb; if it makes sense to do something different,
do what makes sense. For example, if there is an established convention such as do what makes sense. For example, if there is an established convention such as
{#syntax#}ENOENT{#endsyntax#}, follow the established convention. {#syntax#}ENOENT{#endsyntax#}, follow the established convention.
@ -9998,6 +10005,7 @@ coding style.
{#header_open|Examples#} {#header_open|Examples#}
{#code_begin|syntax#} {#code_begin|syntax#}
const namespace_name = @import("dir_name/file_name.zig"); const namespace_name = @import("dir_name/file_name.zig");
const TypeName = @import("dir_name/TypeName.zig");
var global_var: i32 = undefined; var global_var: i32 = undefined;
const const_name = 42; const const_name = 42;
const primitive_type_alias = f32; const primitive_type_alias = f32;