Skip to content

Latest commit

 

History

History
25 lines (14 loc) · 981 Bytes

02.-names.md

File metadata and controls

25 lines (14 loc) · 981 Bytes

02. Names

2.1 Types use lower_snake_case

Type names should always be lower_snake_case. This includes all types: structs, classes, typedefs, traits/interfaces, enums, etc.

my_new_type := class

2.2 Interfaces are adjectives

Interfaces should be adjectives where possible, such as printable, enumerable. Where adjectives don’t seem right, append _interface to the name instead.

my_new_thing_interface := interface

2.3 PascalCase everything else

All other names should be PascalCase. Modules, member variables, parameters, methods, and so on.

MyNewVariable:my_new_type = …

2.4 Parametric Types

  • Name parametric types t or thing, where thing explains what the type is supposed to represent. For example: Send(Payload:payload where payload:type) You’re sending some parameterized data, Payload, of any payload type.
  • If there’s more than one parametric type, avoid using single letters, such as t, u, g
  • Never use _t suffix.