aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorVexu <git@vexu.eu>2020-05-13 19:28:14 +0300
committerGitHub <noreply@github.com>2020-05-13 19:28:14 +0300
commit4b898893e21fc644c4e7a163232e5e98631640d6 (patch)
treece6afa5a2c74d45103a67b25cccb2ef229f12288 /doc
parent118db892bea5222a509a9f91abe560b52a5f08eb (diff)
parent3a397795be1c0219a3a0d96082ee7d4eeddbfa7a (diff)
downloadzig-4b898893e21fc644c4e7a163232e5e98631640d6.tar.gz
zig-4b898893e21fc644c4e7a163232e5e98631640d6.zip
Merge pull request #5254 from ifreund/top-level-struct-file-names
Apply naming conventions of structs to files
Diffstat (limited to 'doc')
-rw-r--r--doc/langref.html.in8
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in
index 5bf91ca70f..ab84209d5e 100644
--- a/doc/langref.html.in
+++ b/doc/langref.html.in
@@ -9988,6 +9988,13 @@ coding style.
conventions.
</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,
do what makes sense. For example, if there is an established convention such as
{#syntax#}ENOENT{#endsyntax#}, follow the established convention.
@@ -9996,6 +10003,7 @@ coding style.
{#header_open|Examples#}
{#code_begin|syntax#}
const namespace_name = @import("dir_name/file_name.zig");
+const TypeName = @import("dir_name/TypeName.zig");
var global_var: i32 = undefined;
const const_name = 42;
const primitive_type_alias = f32;