Skip to content

v0.2.0

Choose a tag to compare

@0xErwin1 0xErwin1 released this 16 Jan 18:43
· 1542 commits to main since this release

Ignis v0.2.0 Release Notes

Overview

Ignis v0.2.0 introduces generics, user-defined types, and namespaces. This release significantly expands the language's type system while maintaining the compile-to-C approach.

New Features

Generics

Type parameters for functions, records, enums, and type aliases:

function identity<T>(x: T): T {
    return x;
}

record Box<T> {
    value: T;
}

enum Option<T> {
    SOME(T),
    NONE,
}

type Alias<T> = Box<T>;

Generics are monomorphized at compile time, producing specialized code for each instantiation.

Records

User-defined struct types with fields and methods:

record Point {
    x: i32;
    y: i32;
    
    distance(): f64 {
        return Math::sqrt((self.x * self.x + self.y * self.y) as f64);
    }
    
    static origin(): Point {
        return Point { x: 0, y: 0 };
    }
}

Enums

Algebraic data types with unit and payload variants:

enum Result<T, E> {
    OK(T),
    ERROR(E),
}

enum Color {
    RED,
    GREEN,
    BLUE,
}

Enums compile to tagged unions in C.

Namespaces

Module-level organization with :: access:

namespace Math {
    function add(a: i32, b: i32): i32 {
        return a + b;
    }
}

let sum: i32 = Math::add(1, 2);

Extern Blocks

Group FFI declarations by library:

extern libc {
    function puts(s: string): i32;
    function printf(format: string, ...): i32;
}

Type Aliases with Generics

Type aliases now support type parameters:

type IntBox = Box<i32>;
type Identity<T> = T;
type BoxAlias<T> = Box<T>;

For-Of Loops

Iterate over arrays:

let arr: i32[3] = [1, 2, 3];
for (let x of arr) {
    // x is i32
}

Function Overloading

Multiple functions with the same name but different signatures:

function print(x: i32): void { ... }
function print(x: string): void { ... }

Other Additions

  • Ternary expressions: condition ? then : else
  • Null pointer type for explicit null handling
  • Record and enum static fields and methods

Breaking Changes

None. v0.2.0 is backwards compatible with v0.1 code.

ABI Changes

  • Records compile to C structs with field_N naming
  • Enums compile to tagged unions with discriminant tag
  • Generic names use ____ separator (e.g., Box____i32)
  • Namespace names use _ separator (e.g., Math_add)

See docs/ABI_v0.2.md for details.

Documentation

Known Limitations

  • No pattern matching (match expressions) yet
  • No closures/lambdas
  • No traits/interfaces
  • No associated types

Upgrade Guide

No changes required. Existing v0.1 code compiles without modification.

# Rebuild the standard library
ignis build-std

# Recompile your project
ignis build

Full Changelog: v0.1.1...v0.2.0