- Open braces on same line, unless you need to wrap.
- If a list of things is longer than 2, put each item on its own line and exercise the ability to put an extra comma at the end.
- Line length: aim for 100; use common sense.
Roughly speaking: , TitleCaseTypeName
, snake_case_variable_name
. More precisely:
- If
x
is callable, andx
‘s return type istype
, thenx
should beTitleCase
. - If is otherwise callable, then
x
should becamelCase
. - Otherwise,
x
should besnake_case
.
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 TitleCase
. Otherwise, it should use snake_case
. Directory names should be .
See the Zig Standard Library for more examples.