Rust feature parity

Om's goal is to support everything Rust programmers rely on, sometimes in a simpler form (see design.md for where Om deliberately differs). This page tracks progress honestly. βœ… works today and is tested, 🟑 partly works, ⬜ planned.

Basics

Feature Status Notes
Functions, recursion, early return βœ…
let, let mut, type annotations, shadowing βœ…
Block expressions, if/else as expressions βœ…
while, loop, for 🟑 for over ranges, for x in &list and for x in list; for x in &mut list and general iterators ⬜
break, continue, break value from loop, loop labels βœ…
Compound assignment += -= *= /= %= βœ…
Integer types i8…i64, u8…u64, isize, usize βœ… i128/u128 ⬜
Literal suffixes, hex/octal/binary literals, exponents βœ…
Literal type inference 🟑 From the surrounding expression; Rust also infers from later uses
Bitwise operators & | ^ << >> ! and their = forms βœ…
Floats f32, f64, including % βœ…
bool, char (Unicode, with escapes) βœ…
as casts βœ… Same rules as Rust: integer widening and truncation, saturating floatβ†’int, u8 as char, char as u32
Overflow checks in debug builds ⬜ Arithmetic currently wraps
const items βœ… Literal values only; const expressions ⬜
Associated constants on built-in types (u8::MAX, f64::EPSILON) βœ… User-defined associated consts ⬜
Standard number and char methods 🟑 The common ones (see the language reference); more over time
static items ⬜
Comments // and /* */ βœ… Doc comments /// ⬜

Data types

Feature Status Notes
Structs with named fields, struct literals, field shorthand βœ…
Field access and assignment, nested structs βœ…
Tuple structs, unit structs ⬜
Enums with unit and tuple variants βœ… Struct-like variants V { x } ⬜
impl blocks, methods, associated functions, Self βœ…
self, &self, &mut self, mut self βœ…
Tuples (a, b), .0 indexing, nested tuples βœ…
Arrays [T; N] and slices ⬜ [a, b] and [x; n] make a Vec for now; str is Om's string slice
Vec[T] βœ… Written in Om (prelude.om): push, pop, insert, remove, swap_remove, truncate, clear, reverse, sort (stable), dedup, contains, append, get/first/last, v[i] with Rust's bounds-check panic, [a, b] and [x; n] literals
String and str βœ… str is a (pointer, length) view like Rust's &str; 40+ methods (find, split, trim, replace, lines, chars, bytes, strip_prefix, split_once, ...); s + "x", s += "x"; to_string() on any value. to_uppercase changes ASCII letters only. Parsing is parse_int() / parse_float() until generic parse::<T>()
Box[T] βœ… *b reads, writes and moves out, field access and methods auto-deref
HashMap<K, V>, HashSet, VecDeque, BTreeMap ⬜ Next batch, with iterators
Recursive types βœ… Through Box or Vec (enum List { Cons(i64, Box[List]), Nil })
Type aliases type X = Y ⬜

Pattern matching

Feature Status Notes
match on integers, bools and enums βœ…
Literal, range (1..=9, 0..10, 'a'..='z'), wildcard and binding patterns βœ…
Nested variant patterns βœ…
Or-patterns A | B 🟑 Without bindings
Match guards if cond βœ…
Exhaustiveness checking with a missing-case example βœ… Same matrix algorithm family as rustc, including integer and char ranges (0..=127 plus 128..=255 covers u8)
if let, while let βœ… let else ⬜
Destructuring in let (tuples, nested, mut bindings) βœ… Refutable let patterns are rejected, as in Rust
Tuple patterns in match βœ…
Struct patterns, .. rest patterns, @ bindings ⬜
String patterns ⬜ Compare with == for now

Ownership and references

Feature Status Notes
&T and &mut T parameters βœ… Mutable value semantics: no lifetimes needed
Aliasing check (&mut x twice in one call) βœ…
Move semantics and use-after-move errors βœ… Including moves in one branch, moves inside loops, moving out of borrowed values, and partial moves of a field
Copy / Clone βœ… Types that own nothing copy implicitly; .clone() works on every type (deep copy) unless it implements Drop, which needs its own Clone impl
Drop βœ… Runs in Rust's order: locals in reverse, fields in order, list elements front to back, temporaries at the end of the statement; drop flags for values moved on some paths. Checked leak-free with valgrind
Borrow checking 🟑 let r = &x, match &x and str views of a String freeze the owner while they live; a view may not outlive its String (returning, storing in an outer variable or a &mut list, or pointing into a temporary are errors). This is a conservative stand-in for Rust's lifetimes, not the full NLL checker
References stored in structs, lifetimes βœ– by design Om uses regions instead (see design)
Raw pointers and unsafe 🟑 Ptr[T] and memory intrinsics exist for the standard library; user-facing unsafe ⬜

Abstraction

Feature Status Notes
Generic functions, structs, enums and impl blocks βœ… Monomorphized like Rust; written f[T], Pair[A, B]
Type inference for generic calls 🟑 From arguments and from the expected type; inference from later uses ⬜
Traits, impl Trait for Type, default methods βœ… Impls on built-in types (impl Ord for i64) and generic types too
Trait bounds [T: A + B], where clauses, bounds on generic impls βœ… Bounds are checked where a generic is used; generic bodies are checked per instantiation, like C++ templates or Zig, rather than against the bounds alone
T::assoc_fn() calls through a type parameter βœ… e.g. T::default()
Trait objects dyn Trait ⬜
Associated types and constants ⬜
Operator overloading 🟑 Add Sub Mul Div Rem Neg (same type on both sides), Eq for == !=, Ord for < <= > >=; Index ⬜
Standard traits Eq, Ord (with max, min, clamp), Default, Ordering βœ… Om merges PartialEq/Eq and PartialOrd/Ord into one trait each
Generic traits (From[T]), supertraits ⬜
#[derive(...)] 🟑 Printing works on any struct or enum with no derive needed
Option[T], Result[T, E] and their core methods βœ… Written in Om itself (prelude.om); more methods arrive with closures
? operator βœ… On Option and Result; error conversion (From) ⬜
Closures and Fn traits ⬜
Iterators and adapters (map, filter, collect) ⬜
Macros (macro_rules!) ⬜ Om plans compile-time functions instead

Program structure and tooling

Feature Status Notes
Modules, mod, use, pub ⬜
Packages and a package manager ⬜
Built-in tests (om test) ⬜
Formatter (om fmt) ⬜
panic, assert, unwrap/expect βœ… Message on stderr, exit code 101 like Rust
Threads, Send/Sync, async ⬜ Om plans structured concurrency
C FFI (extern) ⬜

Extras Om has that Rust doesn't

Default and named arguments, the |> pipeline operator, interpolation of any expression in strings, defer, and printing any value without derive. See the language reference.