Language
Collections and data
Model data with lists, maps, structs and structural interfaces.
Lists and maps
Lists use integer indices. Maps use string keys. Both are mutable reference values and preserve their declared element type.
data.orvi
1struct Server {2 host: string3 port: int = 80804}56interface Named {7 name: string8}910let server = Server("localhost")11let ports: list<int> = [8080, 8081]12let config: map<string> = { mode: "release" }1314server.port = ports[1]15config["mode"] = "debug"
Structs
A struct declares named fields and may provide defaults. Construction supplies required fields positionally in declaration order. Fields can be read and updated with member syntax.
Structural interfaces
Interfaces describe required fields rather than inheritance. A struct satisfies an interface when its field names and types match.
interfaces.orvi
1interface Named {2 name: string3}45struct Job {6 name: string7 retries: int = 38}910fn label(value: Named) -> string {11 return value.name12}1314print(label(Job("release")))