Draft:Rex (programming language)
Systems programming language
From Wikipedia, the free encyclopedia
Rex is a systems programming language designed to provide high performance, strong memory safety, and modern concurrency features. The language is inspired by established programming languages such as C, C++, Rust, and Go. Rex aims to combine low-level control over system resources with compile-time safety mechanisms to reduce common programming errors.
Submission declined on 10 March 2026 by AlphaBetaGamma (talk).
Where to get help
How to improve a draft
You can also browse Wikipedia:Featured articles and Wikipedia:Good articles to find examples of Wikipedia's best writing on topics similar to your proposed article. Improving your odds of a speedy review To improve your odds of a faster review, tag your draft with relevant WikiProject tags using the button below. This will let reviewers know a new draft has been submitted in their area of interest. For instance, if you wrote about a female astronomer, you would want to add the Biography, Astronomy, and Women scientists tags. Editor resources
|
| Rex | |
|---|---|
| Paradigm | Multi-paradigm: imperative programming, concurrent computing, systems programming |
| Designed by | 0xh7 |
| Typing discipline | Static, strong, type inference |
| OS | Cross-platform |
| License | MIT License |
| Website | 0xh7 |
| Influenced by | |
| C, C++, Rust, Go | |
The Rex compiler uses a front-end written in Lua and targets C code generation. This approach allows Rex programs to compile into portable C code that can run efficiently across different operating systems and hardware platforms.[1]
Rex focuses on addressing long-standing challenges in systems programming, particularly memory management and concurrent execution. By introducing concepts such as strict ownership rules and transactional state management through its bond system, the language aims to prevent memory leaks, data races, and other concurrency-related errors during compilation rather than at runtime.[1]
Design principles
The design of Rex follows several core principles intended to improve reliability and developer productivity in systems programming:
- Predictable performance – Rex compiles to C and avoids runtime garbage collection, allowing performance comparable to languages like C and C++.
- Memory safety without garbage collection – Ownership and borrowing rules enforce safe memory access during compilation.
- Concurrency by design – The language includes built-in primitives for safe concurrent execution.
- Developer productivity – Clean syntax and type inference aim to reduce boilerplate code.
- Structured error handling – The
Resulttype and the?operator allow explicit and predictable error management.
Core features
Ownership and borrow checking
Rex implements an ownership-based memory management model. Every value in Rex has a single owner, and ownership is transferred when values are passed to functions or assigned to new variables. This prevents common memory errors such as use-after-free.
The Rex compiler also includes a borrow checker that ensures safe references to data. The borrow rules include:
- Multiple immutable references may exist simultaneously.
- Only one mutable reference may exist at a time.
- Mutable and immutable references cannot coexist.
These rules are enforced at compile time, eliminating the need for a garbage collector.[2]
Bond system
Rex introduces a transactional state-management mechanism using the keywords bond, commit, and rollback. This mechanism allows a group of operations to be executed atomically.
fn update_player_score(mut player_score: i32, points: i32) -> Result<i32, str> {
bond temp_score = player_score
temp_score += points
if temp_score < 0 {
rollback
return Err("Score cannot be negative")
} else {
commit
return Ok(temp_score)
}
}
This feature allows developers to ensure that changes to program state are either fully applied or completely reverted.[3]
Concurrency primitives
Rex provides built-in support for concurrent programming:
spawncreates lightweight concurrent tasks.channelsprovide safe communication between tasks through ownership transfer.
These mechanisms aim to reduce the complexity and risk associated with multithreaded programming.
Type system
The Rex type system supports several modern programming constructs:
- Structs for grouping related data
- Enums for algebraic data types and pattern matching
- Generics for reusable abstractions
Deferred execution
The defer keyword ensures that cleanup code is executed when leaving the current scope.
fn process_file(path: str) -> Result<str, str> {
let file = fs.open(path)?
defer { fs.close(file) }
Ok("Success")
}
This feature simplifies resource management such as file handling.
Syntax
Rex syntax is influenced by the C family of programming languages and uses curly braces ({}) to define code blocks.
Variables
let x = 10
mut y = 20
y = y + 1
Functions
fn add(a: i32, b: i32) -> i32 {
return a + b
}
Standard library
Rex includes a standard library that provides tools for systems programming.[4]
| Module | Description |
|---|---|
rex::io | Input and output utilities |
rex::fs | File system operations |
rex::thread | Thread management and synchronization primitives |
rex::fmt | String formatting utilities |
rex::net | TCP and UDP networking |
rex::http | HTTP communication and JSON handling |
rex::collections | Data structures such as vectors and hash maps |
Command-line tools
The Rex toolchain includes several command-line utilities:[1]
rex run— compile and execute a source filerex build— compile a standalone executable via Crex check— perform static analysis without compilingrex fmt— automatically format source code

- provide significant coverage: discuss the subject in detail, not just brief mentions or routine announcements;
- are reliable: from reputable outlets with editorial oversight;
- are independent: not connected to the subject, such as interviews, press releases, the subject's own website, or sponsored content.
Please add references that meet all three of these criteria. If none exist, the subject is not yet suitable for Wikipedia.