the-language
the-language copied to clipboard
Parsing bug - didn't find comments:
how_to\007_struct_literals.jai:157..160
:
result_1 := is_constant(Vector3.{R22, R22, 0}); // This returns true, as R22 is a compile-time constant!
result_2 := is_constant(Vector3.{1 - R22*R22, 0, cast(float) Z}); // This is constant! Math between constants, and casts on constants, are guaranteed to be known at compile-time.
result_3 := is_constant(Vector3.{cast(float) #run sin(factorial(3) * .5), 1, 0}); // This is also constant! We ran sin at compile-time, which then executed the call to factorial(), so we know the answer at compile-time. #run will be covered later, sorry..!
result_4 := is_constant(Vector3.{cast(float) factorial(3), 1, 0}); // This is not constant; with no #run, the factorial(3) is being invoked at runtime instead of compile-time.