3 ms·
Ah, sorry. So the reason _why_ we want the code to be explicit is that we want to be explicit always of the coordinate system we are in. Otherwise _extremely_
by fsloth 1y ago
Ah, sorry.
So the reason _why_ we want the code to be explicit is that we want to be explicit always of the coordinate system we are in. Otherwise _extremely_ hard to find bugs can and will creep in - a float is a float.
The stuff I worked on input coordinates were left handed but the output coordinates were right handed.
- 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.