Breaking changes
- The
Measure.dimensionandMeasure.dimensionlessfunctions now require a unit system as their first parameter. TheMeasure.dimensionfunction can no longer arbitrarily produce new dimensions. To add new dimensions, create a newUnitSystem. - Changed the way in which unit exponents are represented. Exponents are now numbers instead of strings and units contain every dimension in their unit system even if the exponent is zero.
- Removed the ability to arbitrarily perform exponentiation on measures. The
measure.toTheandMeasure.powfunctions have been removed. - Removed the ability to perform roots of measures. The
Measure.sqrtandMeasure.cbrtfunctions have been removed.
New features
- Introduced the concept of a unit system. Unit systems define a fixed set of dimensions and their corresponding base units. Measures of a given unit system are not assignable to measures of other unit systems. Safe units ships with a default implementation of the SI unit system as
SIUnitSystem. - Removed the limitations on exponents. Previously, exponents of dimensions had to be between -5 and +5. Now the limit on exponents is much larger and should no longer present any issues.
- Added a new
valueInmethod to theMeasureclass. Callingmeasure.valueIn(unit)is syntactic sugar formeasure.div(unit).value.
Fixes
- Fixed an issue where measures could be assigned to measures of different unit types if they contained a superset of the other measure's dimensions. In order to fix this, the concept of unit systems was introduced.
- Fixed incorrect symbols for the
joulesandwattsunits.