Guiding Principles
Guiding Principles of Tuplet
Minimize Ambiguity
Some ambiguity is unavoidable in programming. Much is not.
Whenever possible you should always know what kind of thing you're looking at. To help with this we have the following rules.
- Variable names use
snake_case
. - Global variables start with an at sign (it looks like a little globe):
@EXAMPLE_GLOBAL
- Function names use
kebab-case
. - Functions always end with a colon:
example-function-name:
This applies when defining them and when calling them. - When passing a reference to a function, instead of calling it, you append a trailing tilde:
my-function:~
- When de-referencing a function (calling one you've been passed) you flip the trailing sigils to the other end:
~:my-function
(or simply call it with thecall:
function). - Indentation is significant, like in Python. Unlike Python, we only allow the use of tabs for indentation. That way you don't end up with errors because one developer used spaces and the other used tabs, and they're both invisible. We use tabs because they're specifically designed for the purposes of indenting text. Significant indentation helps minimize scope confusion.
- what a function returns is always obvious because it's prefaced by the
return
keyword
Facilitate Clarity of Meaning
- By leveraging Contracts we can generate basic documentation for any function that makes it clear what type each variable is and what the function returns.
Facilitate reliability
- By leveraging Contracts we can generate fuzz tests for expected input.
- By leveraging Contracts we can help guarantee the code only receives expected inputs.