85 lines
3.5 KiB
Plaintext
85 lines
3.5 KiB
Plaintext
---
|
|
title: Philosophy
|
|
description: The mindset, ergonomics, and feeling of writing Mist.
|
|
icon: Brain
|
|
---
|
|
|
|
**Mist** is a pragmatic systems programming language built on Rust. It uses C/C++ style syntax for quick onboarding while compiling directly to efficient Rust code with zero-cost abstractions and no runtime overhead.
|
|
|
|
All of your favorite Rust libraries work with Mist. It is designed for **low-level applications and embedded programming**, where a type-first approach is preferred and staying close to the metal matters.
|
|
|
|
---
|
|
|
|
## C++ You Know, Rust You Trust
|
|
|
|
Mist is meant to feel like C++ but **be** Rust. It bridges the gap between the ergonomics of a classic systems language and the safety guarantees of Rust's ownership model.
|
|
|
|
### Type-First Syntax
|
|
|
|
Low-level and embedded development demands clarity about what your data is. Mist puts the **type first** — before the name — so declarations read naturally:
|
|
|
|
```mist
|
|
i32 score = 100;
|
|
Vec<String> args = env::args().collect();
|
|
void* data = allocate(size);
|
|
```
|
|
|
|
This mirrors C/C++ declaration syntax, making Mist instantly familiar to embedded and systems programmers while compiling into Rust's strict type system.
|
|
|
|
### C-Style Functions
|
|
|
|
Functions use the return type before the name — no `fn` keyword needed:
|
|
|
|
```mist
|
|
i32 add(i32 a, i32 b) {
|
|
a + b
|
|
}
|
|
|
|
void log(message *str) {
|
|
println!("{}", message);
|
|
}
|
|
```
|
|
|
|
Every function maps directly to a Rust `fn` underneath.
|
|
|
|
### Minimal Friction
|
|
|
|
* No `let` keyword — `Type name = value` is all you need.
|
|
* Consistent `name Type` convention across parameters, fields, and locals.
|
|
* Explicit pointers with `*T` and `*mut T` — clear intent without ceremony.
|
|
* String references use `str&` for a natural left-to-right read.
|
|
|
|
---
|
|
|
|
## Built for Low-Level and Embedded
|
|
|
|
Mist is designed from the ground up for systems where resources are constrained and control is required:
|
|
|
|
* **No runtime** — no garbage collector, no hidden allocator, no VM.
|
|
* **Direct memory control** — explicit pointers, manual allocation, predictable layout.
|
|
* **Zero-cost abstractions** — classes, traits, and generics all resolve at compile time.
|
|
* **Works with existing Cargo tooling** — use any Rust crate as a library.
|
|
|
|
---
|
|
|
|
## A Transparent Surface Layer
|
|
|
|
Mist is not a replacement for Rust; it is an **ergonomic interface** for it. It provides a way to interact with the world's most powerful systems model through a cleaner lens.
|
|
|
|
* **Zero-Cost Abstractions:** Every high-level structure in Mist — classes, enums, traits — maps directly to optimized Rust primitives. No magic, no hidden runtime.
|
|
* **Grounded Safety:** Mist doesn't hide memory safety; it makes it easier to express. You retain the full power of the borrow checker with syntax that feels like classic C++.
|
|
* **Native Fluency:** Mist compiles to idiomatic, readable Rust, making it a first-class citizen of the ecosystem. Use any crate while writing code that feels distinctly Mist.
|
|
|
|
---
|
|
|
|
## Bootstrapped Development
|
|
|
|
Mist is partially bootstrapped — the compiler's CLI, transpiler, and analyzer modules are written in Mist itself. This gives us first-hand experience with the language's ergonomics and drives real-world improvements with every release.
|
|
|
|
## Why Mist?
|
|
|
|
* **Familiarity:** C/C++ developers can be productive immediately — no new optical model to learn.
|
|
* **Safety:** Rust's borrow checker and type system under every expression, no exceptions.
|
|
* **Control:** Explicit types, explicit pointers, explicit allocation — nothing hidden.
|
|
* **Ecosystem:** The entire Rust crate ecosystem available at your fingertips.
|