3 ms·
> a float is a float That's not what is happening here. With this software there are no raw floats; all variables are typed by the kind of coordinate system (W
by tantalor 1y ago
> a float is a float
That's not what is happening here. With this software there are no raw floats; all variables are typed by the kind of coordinate system (WGS84, ECEF, etc.)
Using your example, the variables would be typed by left- or right-handed. So it is impossible to mix them up, e.g., perform some illegal operation combining them.
Whether implicit conversion is allowed is just saying, does the programmer have to call a function to convert type A -> B, or can the compiler do that for them?
For example,
void doFoo(LeftHandedVec3 v);
RightHandedVec3 myData;
// With explicit conversion.
doFoo(convertToLeftHanded(myData));
// With implicit conversion.
doFoo(myData);
Does one of these produce more bugs?
- fsloth 1y agoIn my experience for technical applications doFoo(convertToLeftHanded(myData)); wins in every way. This is a very good example of ”code that is so obvious it looks stupid” - and which would be the main style I would promote.