Flux Emerges: A New Systems Language Blending C++, Rust, and Python Syntax
Share this article
A new contender is entering the systems programming arena. Flux, currently under active development, aims to blend the low-level control of languages like C++ and Rust with Python's readability. Its syntax deliberately echoes these established languages, creating an immediately familiar yet distinct identity for developers working close to the metal.
The project's initial release will be intentionally pared down. As noted in its GitHub repository, this first iteration will not support numerous advanced features, including:
- Templates and inheritance
- Operator overloading
- Contracts, traits, or macros
- Complex bitwise/logical operators
A reduced language specification outlines these limitations. The rationale appears clear: establish a robust, working foundation before expanding functionality.
Code Glimpses: Syntax in Action
Flux's visual resemblance to its inspirations is evident in early examples. A basic Hello World demonstrates straightforward structure:
import "standard.fx";
def main() -> int
{
print("Hello World!");
};
More revealing is its approach to non-OOP strings and ambitious goals for smart pointers (despite templates being a future feature):
unsigned data{8}[] as noopstr; // Basic string type
object unique_ptr<T>
{
T* ptr;
def __init(T* p) -> this
{
this.ptr = p;
return this;
};
def __exit() -> void
{
if (this.ptr == !void)
{
(void)this.ptr; // Explicit deallocation
};
};
};
The example highlights planned ownership semantics reminiscent of Rust, though the current compiler lacks the standard library needed to execute such code.
Current Capabilities and Toolchain
Implemented keywords focus on core imperative programming constructs:
- Primitive types (int, float, bool)
- Structs, unions, objects
- Control flow (if/elif/else, while)
- Inline assembly (asm)
- Namespaces and functions
Compilation leverages the LLVM toolchain. Developers can build Flux programs on Linux through a multi-step process:
# Install dependencies
sudo apt install llvm-14 clang-14 lld-14 binutils gcc g++ make
pip install llvmlite==0.41.0 dataclasses
# Compilation workflow
python3 fc.py input.fx > output.ll # Flux to LLVM IR
llc output.ll -o output.s # IR to Assembly
as output.s -o output.o # Assemble object file
gcc output.o -o program # Link executable
./program # Run
The Road Ahead
Flux occupies a fascinating space—prioritizing readability while targeting systems domains. Its deliberate constraints for the initial release suggest a focus on stability and incremental evolution. Key planned features like Foreign Function Interface (FFI) support and a standard library remain on the horizon. For developers intrigued by language design, Flux offers a window into the deliberate tradeoffs involved in building a modern systems language from the ground up. Its success will hinge on navigating the tension between accessibility, performance, and the gradual introduction of complexity—a challenge familiar to its inspirations.