kw open
Reserved keyword
The list of words: §1.4
Syntax
ImplMember = { Attr } [ Vis ] ( Receiver ( "fn" | "op" ) Sig ( Block | "=>" Expr )
| "override" "fn" Sig ( Block | "=>" Expr ) | "open" "fn" Sig ( Block | "=>" Expr )
| "init" Sig ( Block | "=>" Expr ) | "dep" Ident ":" Type | Rpc | Const ) ;Grammar: App. A
Defined in
- 4.7 Embedding and overriding — There is no implementation inheritance.
- 4.3 Construction and constructors — Literal. T{ f1: e1, f2, ..base }
- 1.4 Keywords — Reserved (cannot be used as names)
- 12.7 Dependencies — provide Type = expression (for role r, …)?
- 12.8 Built-in storage and tables — The storage is on every node of the journal role, replication is Raft per shard.
- 18.2 Assertions and fixtures — assert expr is executed in all profiles, including prod (profiles switch off only contracts, §6.7, and the output of dbg, §2.2); on failure
Examples
data Animal { name: str }
impl Animal {
open fn speak() -> str => "..."
fn hello() -> str => "I am {name}: {speak()}"
}
data Dog { embed Animal; breed: str }
impl Dog { override fn speak() -> str => "Woof, {super.speak()}" }
Dog{ name: "Rex", breed: "lab" }.hello() // "I am Rex: Woof, ..."— 4.7 Embedding and overriding
provide Db = Db.open(App.get().dbUrl) for role api, saga
provide Payments = PaymentsClient.new(App.get().stripeKey)
impl Orders { dep db: Db; dep pay: Payments }Related diagnostics
ambiguous-embed, missing-override, override-without-open, bad-init, missing-field, must-close, positional-literal, sealed-literal, duplicate-provide, missing-provide, unknown-role, query-not-sql, shard-count-clamped, table-schema