2 ms·
Java has a good library that supports a variety of measurement units: javax.measure https://docs.google.com/document/d/12KhosAFriGCczBs6gwtJJDfg_QlANT92_lhxUWO2
by cryptos 5y ago
Java has a good library that supports a variety of measurement units: javax.measure
https://docs.google.com/document/d/12KhosAFriGCczBs6gwtJJDfg_QlANT92_lhxUWO2gCY/edit https://docs.google.com/document/d/12KhosAFriGCczBs6gwtJJDfg...
http://unitsofmeasurement.github.io/unit-api/site/apidocs/javax/measure/package-summary.html http://unitsofmeasurement.github.io/unit-api/site/apidocs/ja...
The java.time API goes in the same direction, but is obviously limited to things around time.
I think units should be really expressed with the type system, because types give meaning _and_ safety. If used APIs require typed units you wouldn't even need a coding convention to put the unit in a variable name.