Style Guide

    • 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 a type then x should be TitleCase, unless it is a with 0 fields and is never meant to be instantiated, in which case it is considered to be a “namespace” and uses snake_case.
    • If is otherwise callable, then x should be camelCase.
    • Otherwise, x should be snake_case.

    File names fall into two categories: types and namespaces. If the file (implicitly 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 .

    style_example.zig

    • Omit any information that is redundant based on the name of the thing being documented.
    • Duplicating information onto multiple similar functions is encouraged because it helps IDEs and other tools provide better help text.
    • Use the word assert to indicate invariants that cause safety-checked when violated.