F#'s units of measure do this! Though the compiler checks it, so it's static, not dynamic.
https://fsharpforfunandprofit.com/posts/units-of-measure/