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