diff --git a/content/docs/guide/classes.mdx b/content/docs/guide/classes.mdx index 378fd4b..5926dfa 100644 --- a/content/docs/guide/classes.mdx +++ b/content/docs/guide/classes.mdx @@ -40,17 +40,17 @@ class Dog : Animal { super(name); } - override void speak(&self) + void speak(&self) override { println!("Woof!"); } } ``` -The `override` keyword supports explicit base class targeting: +The `override` keyword supports explicit base class targeting (Required if overriding a nested parent): ```mist -override(Animal) void speak(&self) +void speak(&self) override(Animal) { println!("Woof!"); } diff --git a/content/docs/guide/functions.mdx b/content/docs/guide/functions.mdx index c01e6b7..b45507a 100644 --- a/content/docs/guide/functions.mdx +++ b/content/docs/guide/functions.mdx @@ -1,7 +1,7 @@ --- title: Functions description: Function declarations, self parameters, return types, and unsafe functions. -icon: Function +icon: SquareFunction --- ```mist @@ -48,7 +48,7 @@ Functions use **Allman brace style** (opening brace on the next line). ### Self Parameter -Methods can take `self`, `&self`, `&mut self`, or `self` with lifetimes: +Methods can take `self`, `mut self`, `&self`, `&mut self` additionally with lifetimes: ```mist pub void set_value(&mut self, i32 v) diff --git a/content/docs/guide/operators.mdx b/content/docs/guide/operators.mdx index d8e0f58..9c5195a 100644 --- a/content/docs/guide/operators.mdx +++ b/content/docs/guide/operators.mdx @@ -86,13 +86,13 @@ Macro calls use `!` followed by parentheses, brackets, or braces. let add = (a, b) => a + b; let result = add(2, 3); // 5 -let square = f64 x => x * x; +f64 fn() square = (x) => x * x; ``` Closures can have explicit return types: ```mist -let transform = i32 x => { +let transform = i32 (x) => { x * 2 }; ``` diff --git a/content/docs/guide/syntax-overview.mdx b/content/docs/guide/syntax-overview.mdx index 361de9c..4dcad4d 100644 --- a/content/docs/guide/syntax-overview.mdx +++ b/content/docs/guide/syntax-overview.mdx @@ -41,5 +41,5 @@ pub void external() { } // Public to specific path pub(crate) void crate_only() { } pub(super) void parent_only() { } -pub(in my::module) void module_only() { } +pub(my::module) void module_only() { } ``` diff --git a/content/docs/guide/types.mdx b/content/docs/guide/types.mdx index 3b047fe..1e15a64 100644 --- a/content/docs/guide/types.mdx +++ b/content/docs/guide/types.mdx @@ -9,15 +9,15 @@ icon: Type ```mist i32 // Path type str& // Reference type -&mut i32 // Mutable reference -&'a i32 // Reference with lifetime -*const i32 // Const pointer -*mut i32 // Mutable pointer +i32 mut& // Mutable reference +i32 'a& // Reference with lifetime +i32 unsafe& // Const pointer +i32 mut unsafe& // Mutable pointer (i32, bool) // Tuple type -fn(i32) -> bool // Function pointer type -Fn(i32) -> bool // Closure trait (Fn) -FnMut(i32) -> bool // Closure trait (FnMut) -FnOnce(i32) -> bool // Closure trait (FnOnce) +bool fn(i32) // Function pointer type +bool Fn(i32) // Closure trait (Fn) +bool FnMut(i32) // Closure trait (FnMut) +bool FnOnce(i32) // Closure trait (FnOnce) dyn Trait // Trait object void // Unit type (maps to Rust's ()) 'lifetime // Lifetime @@ -32,10 +32,10 @@ type_expr = { (void | path_type | tuple_type | dyn_type) ~ (unsafe_ref_type | re This means types are written left-to-right naturally: ```mist -i32& // &i32 -i32&mut // &mut i32 -i32&'a // &'a i32 -i32 fn() -> bool // fn(i32) -> bool +i32& // &i32 +i32 mut& // &mut i32 +i32 'a& // &'a i32 +bool fn(i32) // fn(i32) -> bool ``` ### Type Aliases