Persistent comptime variables -- config params

Similar to what @dimdin just posted, you can wrap it too:

pub fn foo() i32 {
    return 42;
}

pub fn bar() i32 {
    return comptime foo();
}

export fn baz() i32 {
   return bar();
}

As was mentioned though, if you add parameters, those need to be deducible at comptime time. You can’t give your function runtime only data and try to run it at comptime. I hope this helps :slight_smile:

1 Like