mun
mun copied to clipboard
Compile-time `const` values
Similar to Rust's const we want to introduce compile-time constants using the const keyword. E.g.:
const UPPER_CAST_CONST: usize = 5;
Some thoughts on the implementation:
- We can create IR constants that are compiled into the source that uses it
- We can create a function (or a memory location really) that holds the value of the constant (which can then be patched at will)
- Type changes also require code changes so that shouldn't be an issue.
- With the not hotreloading case, we simply create an IR constant.
A maybe more interesting topic is what we allow as the value of a constant? We don't have anything like constexpr yet.