Merge pull request #7 from mist-go/v0-0-3

v0.0.3
This commit is contained in:
2026-05-19 15:37:27 +02:00
committed by GitHub
4 changed files with 104 additions and 68 deletions
+82
View File
@@ -0,0 +1,82 @@
---
title: A new release of Mist in may 2026 (0.0.3-alpha4), what's new
author: Klesti Selimaj
date: 2026-05-19
---
## Performance
On my machines, the `mist-test` usually gets transpiled at ~13ms, which is good, but i'm unsatisfied, so i made it "transpile" at ~500µs, sometimes even 275µs, this of course is very dependent of the schedule and overhead.
This was achieved by caching the file's timestamps, and this also saves the Rust compiler a lot of work since it has the same caching system.
## Errors & Mapping
You will notice that the output of the mist code contains something like this:
```rust
/* 9:5 */
let args: Vec<String> = env::args().collect();
/* 11:5 */
if args.len() < 2
{
/* 12:9 */
print_usage();
/* 13:9 */
process::exit(1);
}
```
Those are mappings, the line of the rust file will translate to the line on the comment, example:
```bash
src/main.mist:12:9
Error: cannot find function `print_usage` in this scope
process::exit(1);
```
This is what the input is:
```mist
Vec<String> args = env::args().collect();
if (args.len() < 2) {
print_usage();
process::exit(1);
}
```
The error itself is taken via `--message-format=json` on `cargo` with the `cargo_metadata` crate.
## Syntax changes
### Match
Match patterns now allow `|`:
```mist
match (args[1].as_str()) {
"run" | "build" | "check" | "r" | "b" | "c" => {
var (config, root) = transpiler::build();
}
_ => {}
}
```
## Strings & Macros
After using macros and strings, i noticed that there was bugs everywhere, i now ensure more stable macros, and strings now allow different escape sequences.
## Variables and other statements
Fixed variables declarations like
```mist
Vec<String> args;
```
And also function calls:
```mist
my_func();
```
The reason why bugs occur with these statements is due to ambiguity, at first, they are right, for example:
```mist
// <type> <pattern>
my_func (); // () used to be a pattern.
```
This fix is not perfect, you may encounter the same issues when passing arguments that are also within the pattern range (meaning not full expressions).
+18 -6
View File
@@ -11,7 +11,7 @@ Mist is currently distributed as a Cargo crate. To get started, you'll need to h
Run the following command to install the Mist compiler:
```bash title="Terminal"
cargo install [email protected].2-alpha0
cargo install [email protected].3-alpha4
```
Once the installation finishes, verify it by checking the version:
@@ -52,11 +52,24 @@ Since Mist compiles down to Rust, you need to point Cargo to the generated outpu
```toml title="Cargo.toml"
[[bin]]
name = "main"
name = "my-mist-app"
path = "build/main.rs"
```
> **Pro Tip:** You’ll probably want to add `/build` to your `.gitignore` file to keep your repository clean!
You can also add `/build` to your `.gitignore`.
> **Pro Tip:** create a `src/_header.rs` file with only main declared, and add this to your `Cargo.toml` (without replacing the current `[[bin]]`):
> ```toml title="Cargo.toml"
> # add this in [package]
> default-run="my-mist-app-header"
>
> # Do not replace the current [[bin]]
> [[bin]]
> name = "my-mist-app-header"
> path = "src/_header.rs"
>```
>
> And add all of the `mod`(s) from `src/main.rs`, as well as a empty `main` function, this will allow `.rs` files to be used with IDE support.
---
@@ -78,9 +91,7 @@ To turn your Mist code into an executable, use the `run` command:
mist run
```
> **Pro Tip:** If you encounter any rust errors, head to the build directory and analyze the output, if you see anything unusual in the output, report the issue at https://github.com/mist-go/mist
Or if you only want to transpile to rust
Or if you only want to transpile to rust (this will not give any semantic errors, only syntax errors).
```bash title="Terminal"
mist transpile
@@ -96,5 +107,6 @@ mist transpile
| `mist run` | Runs the project in the current directory |
| `mist build` | builds the project in the current directory |
| `mist transpile` | transpiles the project in the current directory |
| `mist check` | checks the project in the current directory |
| `mist version` | prints the compiler version |
| `mist help` | prints this message |
+1 -62
View File
@@ -6,65 +6,4 @@ icon: TriangleAlert
Mist is currently in a **Volatile Alpha** stage. Our current priority is exploring **Syntax and Features**. We believe in stabilizing the developer experience and the "feel" of the language before locking in the deep architectural logic of the compiler.
---
## The "Syntax-First" Philosophy
Mist is currently in a phase of rapid iteration. We are intentionally keeping the **Semantics** flexible while we finalize the **Syntax**.
* **The Goal:** Finalize a robust, ergonomic feature set first.
* **The Reasoning:** Implementing complex semantic analysis while features are still being added is inefficient. By stabilizing the syntax first, we ensure that adding full semantic depth becomes a cohesive, "single-step" process later in development.
---
## Current Technical Trade-offs
To allow for this rapid syntax exploration, the compiler currently uses a "Shim" model for certain complex Rust operations.
### 1. The Construction Model
To support Mist's unified **Class and Constructor** model, the compiler uses an experimental memory initialization pattern.
* **Mechanism:** The compiler generates a "shell" using `MaybeUninit`, allowing `self` to be used inside the constructor logic.
* **Limitation:** Because full **Definite Assignment Analysis** (semantics) is not yet implemented, the compiler does not verify that every field is assigned. It currently relies on zeroing out memory as a placeholder.
* **Future Fix:** Once the syntax is frozen, we will implement the semantic checks required to generate standard, safe Rust struct literals.
### 2. Inheritance
Inheritance is a major planned feature but is currently **not implemented**.
* **Status:** The syntax for inheritance is being designed, but it will not be functional until the semantic analyzer is built to handle v-tables and memory layouts in the emitted Rust code.
---
## Feature Volatility
Be aware that because we are focusing on syntax, keywords and structures may change between minor versions. Currently:
* **Access Modifiers:** `pub` and private defaults are being tested for various contexts (classes vs. structs, or `pub(crate)`).
* **Pointers vs. References:** The `*` syntax for references (e.g., `self mut*`) is the current standard but is subject to refinement based on ecosystem feedback.
* **Trait Implementations:** The "In-Class" `impl` block is a core feature we are prioritizing for ergonomics.
---
> **Alpha Warning:** Mist is currently a playground for defining a better way to write systems code. Expect breaking changes as we finalize the surface layer of the language.
>
>
You may encounter weird illogical syntax errors, please report them at https://github.com/mist-go/mist/issues with the context.
+3
View File
@@ -32,6 +32,9 @@ match (task_state) {
TaskState::Failed { reason, code } => {
println!("Error {}: {}", code, reason);
}
TaskState::NotResponding | TaskState::Progress => {
draw_loading();
}
_ => {
println!("Other state");
}