Skip to content

0.1.2

Choose a tag to compare

@Morglod Morglod released this 08 Sep 23:58
· 22 commits to master since this release

0.1.2

Compiler

  1. i128 / u128 fully supported now.

Because untyped literals are i128, for full u128 bit constant, it should be explicitly typed.

  1. Hard error when specifiying default values for comptime (generic) arguments in functions

  2. Function pointers now could survive comptime -> runtime, so it can be used as generic params

struct Container($F: *fn(): i32) {
    x: i32;
};

fn foo(c: *Container($F)): i32 {
    return $F();
}

fn goo(): i32 {
    return 10;
}

fn boo() {
    x: Container(goo.^) = 0;
    foo(x.^);
}
  1. Conditional compilation with #if (condition) { ... } else { ... }
    Good replacement for "#run { #emit }" pattern
    It is more performant (because avoids code generation and parsing) and is not deferred as #run
#if (mox_platform == .x86_64_win) {
    import "./win.mox";
} else {
    import "./not_win.mox";
}
  1. Indexing generic bound array fixed
struct Generic($ARR: [$N]u64) {}
fn index(a: *Generic($ARR), i: i64): u64 {
    return $ARR[0]; // now works
}
  1. Inferring poly arguments of function pointer now works

Modules

  1. Rapidhash implementation

  2. Comptime error when not enough values passed to format

  3. Slice split_iterator which iterates over non-splitter sub slices

for (it : split_iterator(",a,b,c", ",")) {
    // it here is: "", "a", "b", "c"
}
  1. parse_int, parse_uint, parse_float utils

  2. Std module that re-exports all core modules, so now only "std.mox" can be imported

  3. Hash maps implementation

  4. A lot of small utils in std lib