Stop Mixing Milliseconds and Seconds with F# Units of Measure
F# units of measure catch mismatched time, length, and quantity units at compile time with zero runtime overhead.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
F# units of measure catch mismatched time, length, and quantity units at compile time with zero runtime overhead.
Crystal's ? suffix makes nilability part of the type system, turning null-reference crashes into compile-time errors. Control-flow refinement narrows types after nil checks, and &. handles optional values inline. Trade-off: nilables spread through generics, increasing verbosity.
F# Units of Measure annotate numeric types with dimensions like metres and seconds, turning unit mismatches into compile-time errors. A projectile calculator shows how velocity, time and distance stay typed end-to-end.
Nim distinct types make passing meters where feet are expected a compile-time error. See a worked example, the boundary friction, and how to roll it out safely.
F# units of measure attach compile-time physical dimensions to numeric types, turning silent unit-mismatch bugs into compiler errors. See a kinetic-energy example, understand runtime erasure, and adopt them on API boundaries.