Safe Flexibility
Table of Contents
Benefits
- Faster Development
- Cleaner Code
-
Safe Flexibility
100% Customizable
units-of-measure takes a novel, metaprogramming approach to the problem of type-safe dimensional analysis. Because the DSL is auto-generated, units-of-measure works great for all engineering and scientific applications.
With just the tweak of a config file, units-of-measure can represent any unit or quantity.
Type-safe Math Library
For even greater safety and ease of use, units-of-measure ships with a type-safe superset of the kotlin.math
library.
This means, for example, that units-of-measure can track units & dimensions even across complex trigonometric expressions.
Lets write a function that uses the law of cosines to solve for m∠C.
Strong Support for Generic Programming
units-of-measure allows you to define relationships between quantities at the type level. All you have to do is pass a “proof” (::p
).
Technical Note: “Proof passing” is a novel technique which leverages Kotlin’s type inference and method overloading capabilities. It allows dimensional relationships to be used as bounds for UOM type parameters.
This means, for example, that we can write generic integration, differentiation, & stdev utilities.
Generic Integrator
Generic Differentiator
Generic Standard Deviation Calculator
‹ Benefit: Cleaner Code Install ›