Any RFC for Units of Measure?

This looks, smells and sounds like something that really-really-really shouldn’t be baked into the language. Typesafe units are nice and probably pretty much necessary for any reasonable numeric/engineering/physics/simulation work that claims to be safe or correct by design. However, they are so fundamentally type-related and well-described by types that before (and ideally, instead) of adding them as magic special cases to the language, we should really strive for making the type system more powerful in general and try to express them in terms of more fundamental features of the type system. In the wider perspective, adding even more built-in traits isn’t much better than requiring globally unique magic constants. While it is of course significantly less fragile, it still doesn’t feel more principled and general at all.

So instead of rushing to an RFC that extends the magic part of the language (of which we already have way more than what would be justified in a language that wants to solve C++'s bloat/complexity issue…) even more, I suggest that we consider instead what kind of expressiveness/additional power the type system needs, and try to achieve those goals in a less coupled, less units-specific manner instead. That would also mean that more potential users could benefit from them.

17 Likes