Skip to content

Latest commit

 

History

History
186 lines (140 loc) · 5.84 KB

File metadata and controls

186 lines (140 loc) · 5.84 KB

ProXPL v1.3.0: The "Pattern Power" Release

Target Release Date: Q2 2026
Status: Planned
Codename: Pattern Power


🌟 Overview

ProXPL v1.3.0 focuses on delivering three long-awaited language features — Pattern Matching, Enums, and Generics — alongside stabilizing the Foreign Function Interface (FFI) and fixing critical bugs identified in v1.2.0.


✨ New Features

1. Pattern Matching (match / case)

First-class pattern matching with exhaustiveness checking.

func describe(value) {
    match (value) {
        case 0 => print("Zero");
        case 1..10 => print("Small number");
        case n if n > 100 => print("Large: " + to_string(n));
        case "hello" => print("Greeting!");
        case [first, ...rest] => print("List starting with " + to_string(first));
        case {name, age} => print(name + " is " + to_string(age));
        case _ => print("Unknown");
    }
}

Implementation Details:

  • New keywords: match, case, _ (wildcard)
  • Range patterns: 1..10, 'a'..'z'
  • Guard clauses: case n if n > 0
  • Destructuring patterns for lists and dictionaries
  • Exhaustiveness checking at compile time
  • New AST nodes: EXPR_MATCH, PATTERN_LITERAL, PATTERN_RANGE, PATTERN_WILDCARD, PATTERN_DESTRUCTURE
  • New opcodes: OP_MATCH, OP_MATCH_RANGE, OP_DESTRUCTURE

2. Enums (Algebraic Data Types)

Type-safe enumerated types with associated values.

enum Color {
    Red,
    Green,
    Blue,
    Custom(r, g, b)
}

enum Result {
    Ok(value),
    Err(message)
}

func process() {
    let status = Result.Ok(42);

    match (status) {
        case Result.Ok(val) => print("Success: " + to_string(val));
        case Result.Err(msg) => print("Error: " + msg);
    }
}

Implementation Details:

  • New keyword: enum
  • Variant constructors with associated values
  • Integration with pattern matching for exhaustive checks
  • Type checker enforcement: all variants must be handled
  • New AST nodes: DECL_ENUM, EXPR_ENUM_VARIANT
  • New opcodes: OP_ENUM, OP_ENUM_VARIANT, OP_IS_VARIANT

3. Generics (Parameterized Types)

Type-safe generic programming without code duplication.

func identity<T>(value: T): T {
    return value;
}

class Stack<T> {
    let items: List<T> = [];

    func push(item: T) {
        push(this.items, item);
    }

    func pop(): T {
        return pop(this.items);
    }

    func peek(): T {
        return this.items[length(this.items) - 1];
    }
}

let intStack = new Stack<int>();
intStack.push(42);

Implementation Details:

  • Angle bracket syntax: <T>, <K, V>
  • Constraint bounds (future): <T: Comparable>
  • Monomorphization at compile-time for AOT path
  • Type erasure for VM/bytecode path
  • Type checker extensions for generic unification
  • New AST nodes: TYPE_GENERIC, DECL_GENERIC_FUNC, DECL_GENERIC_CLASS

4. FFI Stability

Stabilize the Foreign Function Interface introduced in v0.7.0.

  • Type marshaling: Full support for int, float, string, bool, void* parameter types
  • Callback support: Pass ProXPL functions as C callbacks
  • Struct interop: Read/write C struct fields from ProXPL
  • Multi-library loading: Load multiple .dll/.so files simultaneously
  • Error handling: Graceful handling of missing symbols and library load failures
  • Documentation: Complete FFI guide with platform-specific examples

🐛 Bug Fixes

Critical

ID Description Component Severity
BUG-101 Token buffer overflow: main.c uses fixed Token tokens[4096] arrays — large programs crash silently Lexer/main.c 🔴 Critical
BUG-102 REPL version string outdated: Shows v1.0 instead of current version main.c:34 🟡 Low
BUG-103 PRM run parser mismatch: dispatchPRM parses project.pxcf using TOML-style key = "value" but manifest.c uses key: "value" PRM/main.c 🔴 Critical
BUG-104 prm test is a no-op: Always prints "Tests passed! (0 failures)" without actually running tests PRM/main.c:374 🟠 High
BUG-105 prm watch not implemented: Prints stub message and exits PRM/main.c:377 🟠 High
BUG-106 .gitignore file corruption: Lines 137-141 contain NUL bytes (UTF-16 encoding corruption) .gitignore 🟡 Medium
BUG-107 GC mark-and-sweep incomplete: Listed as complete in PHASE_PLAN.md but noted as "not yet implemented" in CHANGELOG.md GC/gc.c 🟠 High
BUG-108 Integer precision: Runtime uses NaN-boxed doubles limiting integer precision to 53 bits value.h/vm.c 🟡 Medium

Improvements

  • Enhanced error messages with contextual suggestions ("Did you mean...?")
  • REPL history and tab-completion support
  • Dynamic token buffer allocation (replace fixed Token[4096] arrays)
  • Standardized project.pxcf parser across all code paths

📊 Compiler Changes

Component Change
Lexer New tokens: TOKEN_MATCH, TOKEN_ENUM, TOKEN_CASE, TOKEN_WILDCARD
Parser New AST nodes for pattern matching, enums, and generics
Type Checker Generic type unification, exhaustiveness checking, enum variant validation
Bytecode Gen New opcodes for match dispatch, enum construction, destructuring
VM Runtime support for enum values, pattern matching, generic type tags

📈 Performance Goals

  • Startup time: < 3ms (cold start)
  • Pattern match dispatch: O(1) via computed jump tables
  • Enum variant check: single-instruction comparison
  • No regression in existing benchmark suite

🔧 Breaking Changes

  • None planned. Full backward compatibility with v1.2.0 code.

📦 Migration Guide

No migration required from v1.2.0. All new features are additive.


ProXPL v1.3.0 — Making types work for you, not against you.