Motivation
We need some way of handling expressions that are evaluatable at compile time but that affect runtime behaviours. Consider the following examples:
integer size = 2+3;
integer[5] v1; // uninit ct-sized -> OK
integer[*] v2; // uninit infered-size -> CT SizeError
integer[*] v3 = 1..2; // init infered-size -> OK
integer[size] v4 = 1..5; // init rt-sized -> OK
integer[size] v5 = 1..4; // init rt-sized -> RT SizeError
integer[size]; // uninit rt-sized -> DONT KNOW !
Only on the integer[size] declaration would we fail, this is because we currently do not propagate constant expressions through the AST. This is particularly problematic in the global scope, where we have to define constants that could have size evaluated from other constants. Consider the above example in the global scope, what would the correct behavior be.
Tasks
Motivation
We need some way of handling expressions that are evaluatable at compile time but that affect runtime behaviours. Consider the following examples:
Only on the
integer[size]declaration would we fail, this is because we currently do not propagate constant expressions through the AST. This is particularly problematic in the global scope, where we have to define constants that could have size evaluated from other constants. Consider the above example in the global scope, what would the correct behavior be.Tasks
constexprfor some expressions to be evaluated at compile time?