Skip to content

Advanced Features

Advanced Features

Generics

Functions can take type parameters with built-in constraints: Ordered, Eq, Numeric.

func abs<T: Numeric>(value: T) -> T:
if (value < 0):
return -value
return value
func min<T: Ordered>(left: T, right: T) -> T:
if (left < right):
return left
return right

Multiple constraints can be combined with +:

func example<T: Ordered + Eq>(left: T, right: T) -> bool:
return left == right

Generic structs and generic impl blocks are parsed by the compiler but are not yet fully available end to end. Use non-generic structs for production code.

pub

pub is a contextual keyword accepted on declarations. It is parsed and stored in the AST but does not yet affect visibility or module exports:

pub func api_function() -> i32:
return 42

intent

intent declares a constraint-based block that the compiler lowers to IR. An intent has optional minimize/maximize constraint expressions and an optional body block:

intent Optimize:
minimize 1
body:
let i: i32 = 0
while (i < 8):
i = i + 1
func main() -> i32:
return 0

flow

flow declares a sequential pipeline with named stage blocks and an optional compensate block:

flow Transaction:
stage acquire:
let auth_state: i32 = 1
stage commit:
let commit_state: i32 = 2
compensate:
let rollback_state: i32 = 3
func main() -> i32:
return 0

What is NOT in the current compiler

The following features are not implemented in the current compiler and do not exist in the language today:

FeatureStatus
enumnot implemented
matchnot implemented
trait / impl fornot implemented
type aliasnot implemented
unsafe blocksnot implemented
defernot implemented
comptimenot implemented
closures / lambdasnot implemented
range loops (0..10)not implemented
array literalsnot implemented
string interpolationnot implemented
loop keywordnot implemented
? result operatornot implemented