Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Units help with some common cases, but units still don't allow you to distinguish between, say, energy, work and torque.



I think that is due to insufficient imaginativeness. For example, energy and work are the same units but energy is an absolute quantity while work is a delta. So arguably work should be a sort of tangent element of the energy, rather than the same thing. There's no distinction in flat space but if you e.g. changed coordinates such that energy was on the surface of a sphere, then work is a spherical displacement instead, which is a totally different class of objects.

Likewise, torque is only in the same units because we don't regard radians as a unit, but we should. They are distinctly different.


Radians can be seen as a ratio of two lengths, the length of your arc and the length of the circumference of the unit circle. All units cancel in such ratios.

> There's no distinction in flat space but if you e.g. changed units such that energy was on the surface of a sphere, then work is a spherical displacement instead, which is a totally different class of objects.

Well, maybe. But in other circumstances you want to treat eg heat and work interchangeably. Just look at https://en.wikipedia.org/wiki/Work_(thermodynamics) and https://en.wikipedia.org/wiki/Work_(physics) and https://en.wikipedia.org/wiki/Work_(electric_field)

Basically, how much you _want_ to encode in your type system depends on the needs of your application. (Approximately all type systems can be made to work for all applications. But they differ in the degree of convenience and error proneness.)


Well by units I was talking about something more akin to differential forms, which distinguish radians and the like just fine.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: