Naming conventions [formatting.naming]
Always use the same identifier style (case, underscores) as the declaration.
Enable --styleCheck:usages
, and, where feasible, --styleCheck:error
.
Ref
forref object
types, which have surprising semanticstype XxxRef = ref Xxx
type XxxRef = ref object ...
func init(T: type Xxx, params...): T
for "constructors"func init(T: type ref Xxx, params...): T
whenT
is aref
func new(T: type Xxx, params...): ref T
for "constructors" that return aref T
new
introducesref
to a non-ref
type
XxxError
for exceptions inheriting fromCatchableError
XxxDefect
for exceptions inheriting fromDefect