Standard Library: Core

The core module provides foundational types and utilities for the MIND language.

Status: this page documents the Core v1 spec surface. In the shipped executable subset, enums and pattern matching (including Option/Result-style sum types) work today, but generics are a bounded slice — a single type parameter over scalar types, monomorphized — so the fully general Result<T, E> form and method calls like .to_string() are spec-level, not yet executable.

Key Exports

  • Option<T> — Represents an optional value.
  • Result<T, E> — Standard error handling type.
  • panic! — Terminates execution with an error message.
  • assert! — Runtime assertions for debugging.

Example Usage (spec-level)

use core::{Option, Result};

fn divide(a: f32, b: f32) -> Result<f32, String> {
    if b == 0.0 {
        return Err("division by zero".to_string());
    }
    Ok(a / b)
}