On Tuesday, 12 April 2011 at 16:44:10 UTC, David Nadlinger wrote:
Recently, I have been playing around with a little units of
measurement system in D. As this topic has already been brought
up quite a number of times here, I thought I would put my
implementation up for discussion here.
When this topic came up previously, it has been proposed to
include units support with Phobos, and thus I have merged my
work into my Phobos fork. Please note, however, that even if we
should come to the conclusion that we really want something
like this in Phobos, this is not a formal review request yet.
There are still a couple of items left on my to-do list, but
I'd like to get some feedback first.
Anyway, here is a link to the code:
https://github.com/klickverbot/phobos/tree/units (std/units.d
and std/si.d). Also, I put up a build of the DDoc output at
http://klickverbot.at/code/units/std_units.html resp.
http://klickverbot.at/code/units/std_si.html.
David
Impressive! I like the idea, in special when you can handled
derived units and doing conversions like this :
convert!(kilo(newton))(2000000 * gram * meter / pow!2(second)));