motiejus/zig

fork of https://codeberg.org/ziglang/zig
git clone https://git.jakstys.lt/motiejus/zig.git
Log | Tree | Refs | README | LICENSE

commit 4b898893e21fc644c4e7a163232e5e98631640d6 (tree)
parent 118db892bea5222a509a9f91abe560b52a5f08eb
Author: Vexu <git@vexu.eu>
Date:   Wed, 13 May 2020 19:28:14 +0300

Merge pull request #5254 from ifreund/top-level-struct-file-names

Apply naming conventions of structs to files
Diffstat:
Mdoc/langref.html.in | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git 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;