Units encode physics and serve as a type system for understanding the physical world.
Been thinking about that concept for a while now. It sounds clean. Maybe too clean——definitely worth consideration.
Naked Numbers
Most calculation happens with naked numbers. A value gets passed around, multiplied, divided, accumulated the meaning of that value lives entirely in someone's head. This one is kilogram. That one is meters per second. The output should be... newtons, I think?
The arithmetic doesn't know. It multiplies with the same indifference whether you hand it a mass or a temperature. This works until it doesn't. The Mars Climate Orbiter is a canonical example: pound-seconds versus newton-seconds, a mismatch invisible to the math, visible only in a crater. But you don't need to go to space to find this failure mode. Medical dosing, structural engineering, financial models——any domain where quantities compose. The number is right. The meaning is wrong.
What's missing is a layer between the numbers and their interpretation. A layer that carries meaning with the value rather than alongside it.
Dimensions as Types
Here's what I find beautiful about units: they form an algebra.
Meters divided by seconds gives you meters-per-second. That's not a convention someone decided on. It's a structural fact about the relationship between length and time. Multiply meters-per-second by seconds and the time dimension cancels, leaving you with meters again. The dimensions participate in arithmetic right alongside the magnitudes. They have their own rules; their own logic.
This is dimensional analysis, and it's been around since Fourier. Physicists lean on it constantly——checking that both sides of an equation carry the same dimensions is often the fastest way to catch a mistake. But I think it's deeper than a debugging technique. Dimensional analysis tells you something about what kinds of operations are meaningful. You can add meters to meters. You cannot add meters to kilograms. That's not a rule someone imposed from the outside. It's a consequence of what those quantities represent.
If you've ever worked with a statically typed language, this should sound familiar. Types constrain the set of legal operations. You can't pass a string where a function expects an integer——not because someone thought it would be fun to restrict you, but because the operation doesn't mean anything in that context. The compiler catches it before runtime; before consequences.
Dimensions do the same thing for physical quantities. They're the type system of the physical world.
What the Type System Buys You
In programming, the pitch for static types is that they make a category of mistake unrepresentable. You don't have to remember to check that a value is the right kind. The structure checks for you.
Dimensional analysis offers the same guarantee. If you're computing a force and your intermediate result has dimensions of length squared over time, something has gone wrong and you know it immediately, without running the experiment, without launching the spacecraft. The dimensions told you.
But there's a subtler benefit. Types don't just prevent errors. They communicate intent. When a function signature says it takes a velocity and returns a distance, you learn something about what that function does before reading a single line of its implementation. The types narrate the physics.
Units work the same way.
The equation F = ma doesn't just happen to produce the right number.
Its dimensional signature——[M·L·T⁻²] = [M]·[L·T⁻²]——tells you why force is what it is. It's the thing you get when mass meets acceleration.
The units aren't annotation.
They're explanation.
The Semantic Layer
I keep coming back to this phrase: semantic layer.
In data engineering, a semantic layer maps raw data to business meaning——it's the thing that turns column rev_q3_adj into "Q3 Adjusted Revenue" and ensures it gets aggregated correctly.
It sits between storage and interpretation.
Units serve exactly this role for calculation. They sit between raw arithmetic and physical meaning. Without them, you have numbers. With them, you have quantities——values bound to the dimensions they inhabit, constrained to combine only in ways that make physical sense.
And the remarkable thing is that this semantic layer is algebraic. It's not a lookup table or a set of ad hoc rules. It's a coherent formal system where dimensions compose, cancel, and transform according to the same operations you're already performing on the magnitudes. The semantics ride for free on the structure of the math itself.
Making the Implicit Explicit
The tragedy, if it's fair to call it that, is how often this layer goes unspoken. We teach students the formulas. We drill the arithmetic and we leave the dimensional reasoning as folk knowledge——something experienced practitioners carry in their heads but rarely formalize.
Every number in a physical calculation is spoken for. It belongs to a dimension. It carries a unit. That's not metadata. That's the meaning.
The type system has been there all along. We just haven't always bothered to acknowledge it.