Force force = 5kg * 9.807 m/s/s;
1. https://github.com/manifold-systems/manifold/tree/master/man...
Force force = 5kg * 9.807 m/s/s;
1. https://github.com/manifold-systems/manifold/tree/master/man...
https://mpusz.github.io/mp-units/latest/getting_started/faq/
If I understand correctly, though, the unit expressions that manifold implements aren't limited to literals, is that correct?
Correct. Unit expressions with manifold are more expressive than with mp-units, as I understand it. With mp-units the unit types themselves are expressively inactive.
For instance, with mp-units the type for velocity, _q_m_per_s (?), must be defined statically as a literal. But with manifold it may be defined as an expression in terms of the component unit types. As such the unit for Velocity, m/s, is an _expression_ of dimension units LengthUnit and TimeUnit.
Velocity sixtyFiveMilesPerHour = 65 mi/hr;
And this provides for user defined literals. VelocityUnit mph = mi/hr;
. . .
Length distance = 80mph * 3.5hr;
It's also a convenience that applies to unitless expressions. For example, manifold defines a Rational number type, which defines a unit-based coercer: RationalCoercion r = RationalCoercion.INSTANCE;
. . .
var oneThird = 1r/3;
Which satisfies other uses, such as: var sixMillionDollars = 6M USD;