v0.2.2-pre-beta

## Major Development Areas ### Variant * Add a n

LunaStev

Major Development Areas

Variant

  • Add a new variant declaration
  • Support generic variants
  • Support payload-less cases
  • Support single- and multi-payload cases
  • Support variant constructors
  • Add variant-specific AST and type representations
  • Add generic type validation for variants
  • Add variant case and payload type validation
  • Add recursive type validation for variants
  • Add variant discriminant handling
  • Add Wave internal ABI contracts for variants
  • Restrict direct exposure of variants through the C ABI

Match

  • Add variant pattern support to the existing match
  • Support payload-less variant case patterns
  • Support variant payload binding
  • Support multi-payload destructuring
  • Support nested variant patterns
  • Support arm-local bindings
  • Add duplicate variant case detection
  • Add exhaustive checking for variant matches
  • Add unreachable pattern detection
  • Integrate exhaustive matches into control-flow and return-path analysis
  • Preserve existing integer, const, and enum match behavior

Proto

  • Add proto Name : Target syntax
  • Support named common method contracts
  • Support multiple target implementations under a single proto name
  • Add proto method surface consistency validation
  • Add duplicate (proto, target) implementation detection
  • Add overlap detection for generic target implementations
  • Support proto names in generic constraints
  • Support proto constraints on generic functions
  • Support proto constraints on generic structs
  • Support proto method resolution inside constrained generic contexts
  • Detect generic usage that does not satisfy constraints
  • Handle resolution between inherent methods and proto methods
  • Preserve existing colon-less proto behavior
  • Preserve static method resolution without runtime vtables

Imports and Namespaces

  • Introduce an independent namespace for each imported source unit
  • Remove global flattening of imported declarations
  • Distinguish internal declarations from externally visible declarations
  • Support qualified name lookup
  • Improve duplicate import handling
  • Add import cycle diagnostics
  • Apply the same module boundaries to functions, structs, type aliases, enums, variants, protos, consts, and statics
  • Add module declaration syntax
  • Add public/private visibility syntax
  • Add qualified name syntax
  • Add selective import and alias syntax

Conditional Mutation

  • Disallow assignment inside if conditions
  • Disallow assignment inside else if conditions
  • Disallow assignment inside while conditions
  • Disallow assignment inside for conditions
  • Disallow compound assignment inside conditions
  • Disallow increment/decrement inside conditions
  • Detect mutation inside nested expressions
  • Preserve ordinary assignment statements
  • Preserve mutation in the for increment section
  • Improve diagnostics for confusion between comparison and assignment

Supported Syntax

Variant

variant Result<T, E> {
    Ok(T),
    Err(E)
}

variant Option<T> {
    Some(T),
    None
}

Variant Match

match result {
    Result::Ok(value) => {
        use_value(value);
    }
    Result::Err(error) => {
        handle_error(error);
    }
}

Proto Contract

proto Printable : Result<T, E> {
    fun print(self) {
        // ...
    }
}

Generic Constraint

fun print_all<T: Printable>(values: ptr<T>, count: i64) {
    var index: i64 = 0;

    while (index < count) {
        values[index].print();
        index += 1;
    }
}