3 ms·
Of course, fixed point would have been a reasonable choice too. But here is my point. Someone who likes testing could say "This bug would have been caught with
by bjourne 3y ago
Of course, fixed point would have been a reasonable choice too. But here is my point. Someone who likes testing could say "This bug would have been caught with better testing". Someone who likes static typing could say "This bug would have been caught if they had used an esoteric type system with support for physical quantities." ... Which no one uses. Thus, you have an argument between something real and realistic, and something imagined and unrealistic.
- thfuran 3y agoThat you aren't familiar with something hardly makes it imaginary. That exact formulation of unit system is, I think, pretty uncommon, but there are widely used languages (vhdl) where uniting is more directly part of the type system and widely used uniting systems as libraries (boost) where it is not directly a language feature.
- bjourne 3y agoVHDL physical types are nothing more than annotated integers. Making them completely useless for general arithmetic. You could not use them for converting from say Celsius to Fahrenheiht. It's cute that you bring up Boost which contains everything and the kitchen sink as evidence of "widely used". Show me a 3d engine that uses physical units for distance calculations. No one does it because it is a horrible idea.
- HideousKojima 3y agoHow about "This bug would have been caught if instead of storing the distance in a float, they stored it in a struct/class that also contained an enum defining the units". Just about any language could handle that.