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.