kw as
Reserved keyword
The list of words: §1.4
Syntax
Import = ( Ident | OpSymbol ) [ "as" Ident ] ;Env = Expr [ "as" Ident ] ;Postfix = Primary { "(" [ Args ] ")" [ TrailingBlock ] | "[" Expr "]" | "." ( Ident | IntLit | "[" Expr "]" )
| "?." Ident | "?" | "!" | "as" Type | "is" Type } ;Grammar: App. A
Defined in
- 5.3 Overloading and user-defined operators — Overloading built-in operators — op declarations in impl
- 5.2 Precedence and associativity — Precedence and associativity
- 1.4 Keywords — Reserved (cannot be used as names)
- 2.2 Import — The first segment of the path MUST be std, self, super or the name of a dependency from oxl.toml.
- 3.1 Primitives — Integer arithmetic.
- 13.2 Authentication — Providers are set in cluster { auth { …
- 16.2 C++ — import cpp "engine/math.hpp" { Vec3, Mat4, lerp } supports
- 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
impl Vec3 {
static op +(a: Vec3, b: Vec3) -> Vec3 => Vec3(a.x + b.x, a.y + b.y, a.z + b.z)
static op *(v: Vec3, k: f32) -> Vec3 => Vec3(v.x * k, v.y * k, v.z * k)
static op -(v: Vec3) -> Vec3 => v * -1.0
op [](i: usize) -> f32 { … } // read by index
var op [](i: usize) -> &var f32 { … } // write by index
op ()(t: f32) -> Vec3 { … } // call as a function
static op <=>(a: Vec3, b: Vec3) -> Ordering { … }
op as Vec4 => Vec4(x, y, z, 1.0)
}— 5.3 Overloading and user-defined operators
use std.time { Duration, now }
use std.http.{Client as Http}
use self.billing { charge } // a module of one's own package
use super.common { Money } // the parent module
use auth.tokens { verify } // a dependency from oxl.toml
use parsers { <|> } // importing an operator
use std.coll.* // all pub names (a warning in libraries)Related diagnostics
not-callable, not-overloadable, operator-decl, range-not-iterable, chained-comparison, bad-import-root, glob-import, import-conflict, unresolved-import, unresolved-name, cluster-auth, fixture-yield