Type-Level Operations

Metatypes like #int, #bool, or #str are not limited to values: a set of operations are available at the type level via const generics. These allow expressing rich definitions, constraints and conditions. They must be surrounded by curly braces inside type expressions, but may appear naked in other contexts like gen if conditions.

The following operations are supported:

Some extra function-like operations are supported:

Using Const Generics as Values

Type-level operations can also be included in expressions directly using const type { ... }. This provides a shortcut around certain language impositions, for example allowing arbitrary-precision arithmetic and division to be performed freely and unconstrained from concerns like bit widths.

    const type { 300 / 7 /* spooky! but it's not actually a divider */ }