1.4 Naming Conventions
The rhombus language’s bindings follow certain naming conventions. While Rhombus does not impose a naming convention syntactically, authors of new libraries are encouraged to stick to rhombus conventions where possible.
Most names use “snake case,” where the leading character is lowercase and multiple words are joined by _. Spelled-out words are preferred, but abbreviations are used in place of long words that must be written especially often. Examples:
Syntactic form names like fun, def, and cond are lowercase and abbreviated forms of the words “function,” “definition,” and “conditional,” respectively.
The names match and class are short enough that no abbreviation would be needed, while namespace and interface are spelled out because they are needed much less frequently than forms like def.
The function to_string and the syntactic form use_static include _ to join its words, as do function names like Bytes.copy_from and Bytes.utf8_string within the Bytes namespace.
A leading capital letter and “Pascal case” (where multiple words are joined by capitalizing each word) are used for a name that refers to a class, interface, a syntax class, or an annotation that in principle refers to an interface. Examples:
The Posn class defined as an example through this manual and Rhombus is capitalized, since it’s a class.
Both the Identifier annotation and Identifier syntax class are capitalized. Although the Identifier annotation is not implemented through an interface internally, it refers to an in-principle interface that would be implemented by identifier syntax objects.
The NonnegInt annotation matches a subset of integers, and much like Identifier, it corresponds in principle to an interface that is implemented by nonnegative integers.
The ReadableString.to_string annotation is a converter annotation, which means that it does not simply refer to an interface (even in principle), so the name to_string is not capitalized.
Annotation constructors are not capitalized, including maybe, matching, or the of in Posn.of.
Namespaces that do not also refer to a class or interface are not capitalized, including the math of math.pi.