Updated visibility

This commit is contained in:
2026-05-14 01:21:34 +02:00
parent 86f14d8f81
commit 2a07051eea
7 changed files with 25 additions and 25 deletions
+4 -4
View File
@@ -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);
}
```
+2 -2
View File
@@ -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,
+3 -3
View File
@@ -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;
}
```
@@ -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,
}
```
+9 -9
View File
@@ -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,
}
```
+3 -3
View File
@@ -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);
}
```
+1 -1
View File
@@ -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.