<p>Marco:</p>
<p>>>> auto distance = <a href="http://100.km">100.km</a>;<br>
>>> auto speed = <a href="http://120.km/hour">120.km/hour</a>;</p>
<p>>> Sounds fun. I mean, it makes me happy to see code written like this instead of<br>
>> Distance distance = new Kilometers(100);<br>
>> Speed speed = Speed.fromDistanceByTime(new Kilometers(120), new Hours(1));</p>
<p>Yeah, that was exactly one of my goals :)<br></p>
<p>David:<br></p>
<p>> I find multiplication to read much more natural:<br>
> ---<br>
> enum km = kilo * meter;<br>
><br>
> auto distance = 100.0 * km;<br>
> auto speed = 100.0 * km / hour;<br>
><br>
> auto timeToDest = distance / speed;<br>
> ---</p>
<p>This is good too. I have code that autogenerate the SI-prefixed versions (not on Github, I should clean it and push), but thought about offering prefix functions by themselves. Hmm, looking at it, I guess kilo is just 1000 as an enum in your code? That's a good idea.</p>

<p>Anyway, multiplication is good, I just looked for an excuse to play with UFCS :)<br><br></p>
<p>> See <a href="http://klickverbot.at/code/units/">http://klickverbot.at/code/units/</a> for a slightly neglected implementation of this scheme. It supports stuff like defining new units with arbitrary (potentially runtime) conversion factors, properly typechecked affine units (think degrees celsius), etc.</p>

<p>Ah good. I remembered someone posting something on units-checking, but couldn't find the message. I also have something on celsius/kelvin and wondered if I needed to go beyond affine, to fully generalize the concept.</p>

<p>Btw, is °C substraction authorized with your module, or multiplication? I wondered what to forbid and what to authorize.</p>
<p>And I (re)discovered while browsing Wikipedia the numerous temperature units I saw at school 15 years ago :)<br></p>
<p>> – but any error messages and symbol names will probably look like if the compiler had a seizure.</p>
<p>why?</p>