Updated docs to 0.3.1

This commit is contained in:
2026-06-10 02:15:44 +02:00
parent 7a498702d7
commit cb5974cc74
12 changed files with 311 additions and 203 deletions
+26 -24
View File
@@ -4,16 +4,16 @@ description: The building blocks of logic, from literals to complex postfix chai
icon: Binary
---
Expressions in Mist are the fundamental units that evaluate to a value. The syntax follows a clean **prefix -> primary -> postfix** chain, providing a predictable structure that maps closely to Rust's mental model.
Expressions in Mist are the fundamental units that evaluate to a value. The syntax follows a clean **prefix -> primary -> postfix** chain, providing a predictable structure.
## Primary Expressions
Primary expressions are the starting point of any logic chain. These include literal values, paths to static members, or grouped expressions in tuples.
Primary expressions are the starting point of any logic chain. These include literal values, paths to members, tuples, arrays, and basic statements.
```mist
var x = 42;
var y = Math::PI;
var coordinates = (10, 20, 30);
let x = 42;
let y = Math::PI;
let coordinates = (10, 20, 30);
```
## Postfix Operations
@@ -21,21 +21,23 @@ var coordinates = (10, 20, 30);
Postfix expressions allow you to build on a primary value with field access, calls, indexing, type casting, error propagation, and mutation operators.
```mist
var len = list.length();
let len = list.length();
s.len();
s.to_uppercase();
var task = Task {
let task = Task {
name: "Drafting",
priority: 1,
};
var first = items[0];
let first = items[0];
println!("Value: {}", first);
```
### Increment & Decrement
```mist
var mut i = 0;
let mut i = 0;
i++;
i--;
```
@@ -56,8 +58,8 @@ flags |= 0x01;
Use `as` to convert between compatible types:
```mist
var x = 42;
var y = x as f64;
let x = 42;
let y = x as f64;
```
### Try Operator
@@ -65,7 +67,7 @@ var y = x as f64;
Propagate errors with the `?` postfix operator:
```mist
var content = fs::read_to_string(path)?;
let content = fs::read_to_string(path)?;
```
### Range Operators
@@ -80,30 +82,30 @@ var content = fs::read_to_string(path)?;
Arrays are initialized with brackets, with an optional repeat notation:
```mist
var arr = [1, 2, 3];
var zeros = [0; 10]; // ten zeroes
let arr = [1, 2, 3];
let zeros = [0; 10]; // ten zeroes
```
## Prefix Operations
Prefixes modify the primary expression that follows them.
Prefixes modify the primary expression that follows them — dereference, reference, negation, and logical not.
```mist
var mut value = 10;
let mut value = 10;
var ref = &value;
var mref = &mut value;
var val = *ref;
var is_false = !true;
var neg = -42;
let ref = &value;
let mref = &mut value;
let val = *ref;
let is_false = !true;
let neg = -42;
```
## Binary Operations
```mist
var sum = 10 + 20;
var is_equal = (x == y);
var complex = (a + b) * (c / d);
let sum = 10 + 20;
let is_equal = (x == y);
let complex = (a + b) * (c / d);
```
## Operator Table