RFC: Units of measurement for D (Phobos?)

David Nadlinger see at klickverbot.at
Sat Apr 16 13:29:08 PDT 2011


On 4/12/11 6:40 PM, David Nadlinger wrote:
> - The helper functions for creating instances of new unit types (scale,
> affine, ...) are currently template functions taking an instance of the
> unit they manipulate as actual argument. This is only for »historical«
> reasons really, would it be cleaner to use just templates?

I just went ahead and changed them to pure templates, having the unit 
helpers as functions only to infer the type of the passed unit instance 
really made no sense in the current design (which uses template alias 
parameters to pass unit instances heavily anyway).

Another missing thing I didn't mention in the original post is support 
for named derived units – currently, there is no way you could enable 
(kilogram * metre / pow!2(second) to be printed as »Newton«. It wouldn't 
be hard to implement, but I didn't really feel the need for it so far…

David



More information about the Digitalmars-d mailing list