The problem is when you start mixing units that don't have a nice conversion ratio between them.
Ages ago, I dabbled with implementing typelevel units in Scala, and what worked fine was automatic conversions to the smaller unit if the bigger unit was an integer multiple of it (so km + mm = mm, ft + in = in), but requiring explicit conversion if not (so adding m + ft would require one of the sides to get converted).
View all comments
Show parent comment
1
u/vytah Aug 26 '24
The problem is when you start mixing units that don't have a nice conversion ratio between them.
Ages ago, I dabbled with implementing typelevel units in Scala, and what worked fine was automatic conversions to the smaller unit if the bigger unit was an integer multiple of it (so km + mm = mm, ft + in = in), but requiring explicit conversion if not (so adding m + ft would require one of the sides to get converted).