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