§3. Types
OxL is statically typed. Type inference is local: the parameter types and the return types of pub/pub(api) functions MUST be given; for private functions the return type MAY be inferred.
In this chapter
| 3.1 Primitives | Integer arithmetic. |
| 3.2 Strings and bytes | Strings and bytes |
| 3.3 Composite types | A literal [a, b] has type List<T> unless the context requires [T; N] or [T]. |
| 3.4 Declared types | data — a product type with named fields (§4.2). |
| 3.5 Unions and optionals | A | B — an anonymous union. |
| 3.6 Aliases, new types and refined types | distinct T creates a new nominal type with the representation of T. |
| 3.7 References and ownership qualifiers | Rules — §7. |
| 3.8 Asynchronous and stream types | Asynchronous and stream types |
| 3.9 Copy and move | Copy types: primitives, str, bytes, Duration, Time and other time types, distinct/refined types over a Copy type, tuples and arrays of Copy types, and data/enum with @derive(Copy) all of whose fields are Copy. |
Related diagnostics
cannot-infer, missing-annotation
See also
Source: docs/spec/oxl-standard.en.md