op !=
!=
Precedence: 4 Associativity: none (a < b < c is an error)
Defined in
- 5.2 Precedence and associativity — Precedence and associativity
- 5.3 Overloading and user-defined operators — Overloading built-in operators — op declarations in impl
- 1.6 Operators and delimiters — + - * / % ** +% -% % +| -| | & | ^ ~ << >> && || !
- 4.6 Interfaces — Interfaces are structural
- 4.2 data — A field: visibility?
Examples
pub(api) interface Storage {
fn get(k: str) -> bytes? io
var fn put(k: str, v: bytes) io
fn has(k: str) -> bool io => get(k) != none // a default method
}
interface ReadWrite { embed Reader; embed Writer }
interface Container<T> { type Item = T; fn items() -> iter<T> }
@explicit interface Persistent { fn key() -> str }
assert FileStorage: Storage // static checkpub(api) data User {
pub(api) id: UserId
pub(api) name: Name
pub(api) email: Email? @since(2)
role: Role = Role.User
createdAt: Time = now()
invariant name != "admin" || role == Role.Admin
}— 4.2 data
Related diagnostics
chained-comparison, not-callable, not-overloadable, operator-decl, range-not-iterable, invalid-char, explicit-interface, interface-not-satisfied, unknown-field