ufcs and integer params
Philippe Sigaud
philippe.sigaud at gmail.com
Fri Jul 20 23:33:16 PDT 2012
> Sorry, that should have been »kilo!gram«. It actually creates a new unit
> with tbua conversion factor of 1000 relative to the base unit (well, it does a
> few more things to handle cases like kilo!(milli!meter)), with the point
> being that the quantities are actually stored in memory "verbatim", i.e.
> without being normalized to e.g. SI units. Making »kilo * gram« work would
> be easy, but I decided it could lead to confusing situations.
At one time, I wanted to make kilo a factory function that would do
the same transformation as your kilo!gram (that is, kilo(milli(gramm))
would in fact return a gram), but I found the style to be too
different from the rest of the code (with value.kg and such).
Btw, how do you handle the fact that in SI, the mass unit is the
kilogram and not the gram?
More information about the Digitalmars-d-learn
mailing list