3 ms·
These semantics make the type incompatible with the Num class and attempting to plug your type into, say, a run of the mill ode solver likely won't do what you
by bjourne 3y ago
These semantics make the type incompatible with the Num class and attempting to plug your type into, say, a run of the mill ode solver likely won't do what you want. So you have two options. 1) Rewrite all code to become "quantity aware". Multiplying two Matrix[Inch] results in a Matrix[Inch2] and so on. 2) Litter your code with floatToInch and inchToFloat conversions. I think you can see why both options suck? If you really can't, then perhaps try finding some safety-critical software that relies on "physical quantity types" in some form or another?
- deleted 3y ago[deleted]
- freilanzer 3y ago> I think you can see why both options suck? Do they suck more than losing spacecraft?
- bjourne 3y agoAbsolutely. Littering a code base with centimeter-to-inch conversions or rewriting every numeric computation to become unit aware would for sure have caused more bugs than it would have prevented.