C# requires basic constant folding for things like numeric types in order to handle correct implicit casting.
For instance byte myByte = 4 needs to be able to infer that the 4 is a byte, and not an int. Basic math operations also need to be valid here, so you need to be able to handle byte myByte = 2 + 3
Basic constant folding on built-in types is handled at the moment.
The plan to reach completion on this task is to add this handling to all extern expressions that can be considered constant. So, for example you could write:
Vector3 myUpVector = Vector3.up * 5;
And it would compile to a vector stored on the heap as (0, 5.0, 0) which at runtime would be compiled to a COPY from the heap constant to myUpVector
C# requires basic constant folding for things like numeric types in order to handle correct implicit casting.
For instance
byte myByte = 4needs to be able to infer that the 4 is abyte, and not anint. Basic math operations also need to be valid here, so you need to be able to handlebyte myByte = 2 + 3Basic constant folding on built-in types is handled at the moment.
The plan to reach completion on this task is to add this handling to all extern expressions that can be considered constant. So, for example you could write:
And it would compile to a vector stored on the heap as (0, 5.0, 0) which at runtime would be compiled to a COPY from the heap constant to
myUpVector