From 2a07051eeafc265ca60bc5c06b0ffe85d5e6205e Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Thu, 14 May 2026 01:21:34 +0200 Subject: [PATCH] Updated visibility --- content/docs/components/classes.mdx | 8 ++++---- content/docs/components/enums.mdx | 4 ++-- content/docs/components/functions.mdx | 6 +++--- .../docs/components/pointers-references.mdx | 6 +++--- content/docs/components/structs.mdx | 18 +++++++++--------- content/docs/components/traits.mdx | 6 +++--- content/docs/limitations.mdx | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/content/docs/components/classes.mdx b/content/docs/components/classes.mdx index 0eb3180..081afe2 100644 --- a/content/docs/components/classes.mdx +++ b/content/docs/components/classes.mdx @@ -11,10 +11,10 @@ Classes in Mist bridge the gap between Java's organizational structure and Rust' A class groups fields and methods together. Fields follow the `type name` convention, and methods define their logic directly within the class body. ```mist -public class Logger { +pub class Logger { String prefix; - public void info(self*, str* message) { + pub void info(self*, str* message) { self.log(LogLevel::Info, message); } @@ -29,7 +29,7 @@ public class Logger { Unlike languages that use the class name for initialization, Mist uses the explicit `constructor` keyword. This makes the entry point of the class unmistakable. ```mist -public constructor(str* prefix) { +pub constructor(str* prefix) { self.prefix = prefix.to_string(); } ``` @@ -39,7 +39,7 @@ public constructor(str* prefix) { Mist maintains Rust's explicit context handling. Any method that needs to access or modify class data must include `self*` (or `self mut*` for mutations) as its first parameter. ```mist -public void warning(self*, str* message) { +pub void warning(self*, str* message) { self.log(LogLevel::Warning, message); } ``` diff --git a/content/docs/components/enums.mdx b/content/docs/components/enums.mdx index 6405c46..c77ca6d 100644 --- a/content/docs/components/enums.mdx +++ b/content/docs/components/enums.mdx @@ -11,7 +11,7 @@ Enums in Mist serve as powerful algebraic data types (ADTs), maintaining the exa An enum can contain unit variants, tuple variants, or struct-like variants. Following Mist's core philosophy, struct-like variants place the type before the identifier. ```mist -public enum TaskState { +pub enum TaskState { Pending, InProgress, Completed, @@ -41,7 +41,7 @@ enum Message { Just like structs and functions, enums declare generics and lifetimes in a unified block. This is particularly useful for defining custom Result or Option types that handle references. ```mist -public enum Validation<'a, T> { +pub enum Validation<'a, T> { Valid(T), Invalid { str'a* message, diff --git a/content/docs/components/functions.mdx b/content/docs/components/functions.mdx index cff5694..975cb0b 100644 --- a/content/docs/components/functions.mdx +++ b/content/docs/components/functions.mdx @@ -25,7 +25,7 @@ void log_status(str* message) { Functions are private to their module by default. The `pub` modifier exports the function for cross-module access. ```mist -public i32 get_version() { +pub i32 get_version() { return 1; } ``` @@ -45,7 +45,7 @@ void update_score(i32 mut current_score, i32 bonus) { Mist integrates type abstraction and memory management into a single generic block. Lifetimes and type parameters share the `< >` bracket following the identifier. ```mist -public str'a* choose_longer<'a, T: Display>(str'a* s1, str'a* s2, T meta) { +pub str'a* choose_longer<'a, T: Display>(str'a* s1, str'a* s2, T meta) { println!("Metadata: {}", meta); return if (s1.len() > s2.len()) { s1 } else { s2 }; } @@ -57,7 +57,7 @@ Metadata is applied via the `#[attr]` syntax directly above the declaration for ```mist #[inline] -public bool is_active(u32 id) { +pub bool is_active(u32 id) { return id > 0; } ``` diff --git a/content/docs/components/pointers-references.mdx b/content/docs/components/pointers-references.mdx index 74d7c57..386a312 100644 --- a/content/docs/components/pointers-references.mdx +++ b/content/docs/components/pointers-references.mdx @@ -23,9 +23,9 @@ void increment(i32 mut* value, i32* limit) { Lifetimes are attached directly to the type before the pointer symbol. This maintains a clean visual flow where the "type-contract" (identity, duration, and mutability) is read from left to right. ```mist -public struct Inspector<'a> { - public str'a* target, - public u32'a mut* counter, +pub struct Inspector<'a> { + pub str'a* target, + pub u32'a mut* counter, } ``` diff --git a/content/docs/components/structs.mdx b/content/docs/components/structs.mdx index 2151d13..70a8c72 100644 --- a/content/docs/components/structs.mdx +++ b/content/docs/components/structs.mdx @@ -11,10 +11,10 @@ Structs in Mist follow the same structural logic as Rust, but apply the language A struct is defined by its name followed by a block of fields. Each field follows the Mist convention of placing the type before the identifier, separated by commas. ```mist -public struct Task { - public String name, - public TaskState state, - public i32 executions, +pub struct Task { + pub String name, + pub TaskState state, + pub i32 executions, } ``` @@ -23,8 +23,8 @@ public struct Task { Use the `pub` modifier to make the struct or its individual fields accessible from other modules. ```mist -public struct NetworkNode { - public u32 id, +pub struct NetworkNode { + pub u32 id, str* address, } ``` @@ -46,9 +46,9 @@ var task = Task { Generics and lifetimes are declared in angle brackets after the struct name. Lifetimes are associated with the reference/pointer type within the field declarations. ```mist -public struct Buffer<'a, T> { - public T'a* data, - public usize len, +pub struct Buffer<'a, T> { + pub T'a* data, + pub usize len, } ``` diff --git a/content/docs/components/traits.mdx b/content/docs/components/traits.mdx index 4224a5c..fbef51f 100644 --- a/content/docs/components/traits.mdx +++ b/content/docs/components/traits.mdx @@ -11,7 +11,7 @@ Traits in Mist define a set of methods that a type must implement, facilitating A trait definition lists method signatures that implementing types must satisfy. Like functions, these signatures place the return type before the method name. ```mist -public trait Drawable { +pub trait Drawable { void draw(self*); str* metadata(self*); } @@ -36,7 +36,7 @@ impl Drawable for Task { Traits can provide default behavior for methods. Types implementing the trait can choose to override these defaults or use the provided implementation. ```mist -public trait Identifiable { +pub trait Identifiable { u32 get_id(self*); bool is_valid(self*) { @@ -49,7 +49,7 @@ public trait Identifiable { Traits can build upon other traits. If a trait requires another trait to be implemented first, use the colon `:` syntax. ```mist -public trait Animated : Drawable { +pub trait Animated : Drawable { void animate(self*, f32 delta_time); } ``` diff --git a/content/docs/limitations.mdx b/content/docs/limitations.mdx index dba83ec..b55f7fe 100644 --- a/content/docs/limitations.mdx +++ b/content/docs/limitations.mdx @@ -53,7 +53,7 @@ Inheritance is a major planned feature but is currently **not implemented**. 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 `public(crate)`). +* **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.