88 lines
1.8 KiB
Plaintext
88 lines
1.8 KiB
Plaintext
---
|
|
title: Mist 0.4.0 is released, virtual methods, array types, and more
|
|
author: Klesti Selimaj
|
|
date: 2026-07-12
|
|
---
|
|
|
|
## New Features
|
|
|
|
### Virtual Methods
|
|
|
|
The `virtual` keyword enables polymorphic dispatch through vtables. Methods marked `virtual` can be overridden in subclasses and will be dispatched dynamically at runtime:
|
|
|
|
```mist
|
|
pub class Animal
|
|
{
|
|
pub virtual void speak(&self)
|
|
{
|
|
println!("...");
|
|
}
|
|
}
|
|
|
|
class Dog : Animal
|
|
{
|
|
void speak(&self) override
|
|
{
|
|
println!("Woof!");
|
|
}
|
|
}
|
|
```
|
|
|
|
### Array Types
|
|
|
|
Fixed-size array types are now supported with `[T; N]` syntax:
|
|
|
|
```mist
|
|
[i32; 10] numbers; // Array of 10 i32s
|
|
[str&; 3] names; // Array of 3 string references
|
|
```
|
|
|
|
### Tuple Variable Declarations
|
|
|
|
Tuple variables can now be declared with explicit type annotations using `as`:
|
|
|
|
```mist
|
|
(i32, bool) as x, y = (1, true);
|
|
|
|
i32 a, b = (1, 2, 3);
|
|
```
|
|
|
|
### Include Directives
|
|
|
|
C-style include directives for importing external files and crates:
|
|
|
|
```mist
|
|
#include <stdio.h> // Global include
|
|
pub use my_crate::module; // Use include
|
|
#include "local.mist" // Local include
|
|
```
|
|
|
|
## Syntax Changes
|
|
|
|
### Allman Style Struct/Enum Fields
|
|
|
|
Struct and enum fields now use semicolons instead of commas:
|
|
|
|
```mist
|
|
// Before (v0.3.x)
|
|
struct Point { i32 x, i32 y }
|
|
|
|
// After (v0.4.0)
|
|
struct Point { i32 x; i32 y; }
|
|
```
|
|
|
|
## Bug Fixes
|
|
|
|
- Fixed default initializers in classes
|
|
- Fixed the mapping system for error remapping
|
|
- Fixed include manifest path resolution
|
|
- Fixed various analyzer bugs
|
|
- Fixed the publish command
|
|
- Fixed completion pollution in LSP
|
|
|
|
## Improvements
|
|
|
|
- Updated bootstrap infrastructure
|
|
- Migrated to core library for `c_void` and classes
|
|
- Removed unnecessary lifetime annotations
|
|
- Fixed generics and function type handling |