an example:
# as expected
let a: int16 = 2
let b = a + 1
echo typeOf b # int16
#not expected
let c = 3
echo typeOf(b + c) # int
for i in 0..b:
echo typeOf(b + i) # int
#not expected and different from the int case
let f: float32 = 3.3
echo typeOf(f + 1.0) # float
#a fix
for i in 0..b:
echo typeOf((b + i).int16)
#better fix
for i in 0'i16..b:
echo typeOf(b + i)
when working with audio, for example, float32 is enough. Regularly results I get are suddenly float. This can be due to operations with (standard) libraries that are apparently not generic or overloaded. Most annoying is that is not predictable (to me). So it feels I have to, almost randomly, decorate with .float32 all through my code.
Is there a compiler switch that tells to use the most restrictive type when multiple types are introduced? The current choice seems to be the least restrictive.
Is there an other way to avoid this?
3.0?