2 ms·
For dynamic languages sure. For strongly typed languages it's better to just use the type system to prevent those kind of things. C++ doesn't have great support
by vlovich123 7y ago
For dynamic languages sure. For strongly typed languages it's better to just use the type system to prevent those kind of things. C++ doesn't have great support here (lots of boilerplate needed) & usually people reach for Boost Units or Boost strong types but it's not that hard (https://www.fluentcpp.com/2016/12/08/strong-types-for-strong-interfaces/ https://www.fluentcpp.com/2016/12/08/strong-types-for-strong...). Mozilla is also exploring this specifically for coordinate spaces & whatnot too (https://research.mozilla.org/2014/06/23/static-checking-of-units-in-servo/ https://research.mozilla.org/2014/06/23/static-checking-of-u...).