ela
Contents

ManualAgents

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 ofIs written
a constantUPPER_CASE
a struct or an enumCapitalised
anything elsesnake_case
  • A proc may type its parameters, and declare its results after ->.
  • --lint checks each call and each use of a result against those types.
  • --lint warns of a name off the style and names the fix.

(ela --spec naming-style, ela --spec results)