Diablo is under development and is not functional yet.
This style guide defines the expected coding conventions to be implemented when using the Diablo programming language. The style guide may evolve over time as the language evolves. Adhere to project-specific styling specifications before using this guide.
Use 2 spaces per indentation level.
Use spaces.
Lines should remain under 80 characters.
Use single quotes for single characters and double quotes for strings.
Use comments only when the code is not self-documenting. However, one should consider refactoring if the code does not naturally self-document. If comments are still deemed necessary, ensure that they explain why code exists, not how the code is implemented.
Documentation strings should be formatted in the following order:
All three docstring sections are required except when a function has zero parameters. In this case, the Argument(s) section can be omitted. As seen in the example, including a space between each docstring section is required.
/// Calculate the sum of two numbers.
///
/// foo: float = Description of the first parameter
/// bar: float = Description of the second parameter
///
/// return: float = Sum of first two arguments.
fn foobar(foo, bar) {
var baz = foo + bar;
return baz;
}
Use snake case (i.e. foo_bar
) for files, functions, variables, and anything
else not explicity listed here.
Use Pascal case (i.e. FooBar
) for class definitions.
All Diablo source files should end with .dbl
.