Names and typed results
In the terminalela --spec names-and-typed-results
Every name follows one style, and a proc can declare its types. --lint then catches a wrong
call before the run, and a reader knows what a proc gives back without reading its body.
ORG :: "Hyperquader-Coders" proc split_host(addr: string) -> (host: string, port: number) parts = str.split($addr, ":") return $parts[0], int($parts[1])end proc host, port = split_host("models.example:8080")
| A name of | Is written |
|---|---|
| a constant | UPPER_CASE |
| a struct or an enum | Capitalised |
| anything else | snake_case |
- A proc may type its parameters, and declare its results after
->. --lintchecks each call and each use of a result against those types.--lintwarns of a name off the style and names the fix.
(ela --spec naming-style, ela --spec results)