Boost.units ported to D

Era Scarecrow rtcvb32 at yahoo.com
Mon Feb 11 14:44:02 PST 2013


On Monday, 11 February 2013 at 22:33:02 UTC, Arlen wrote:
> On Mon, Feb 11, 2013 at 4:18 PM, develop32 
> <develop32 at gmail.com> wrote:
>
>> How about something like meters!15 or newtons!30? For me it is 
>> more pleasing and shorter than multiplication.
>
> 'meters!15' is supposed to be '15 * meters', right?  Then how 
> would you express '15 / meters' ?  You cannot; therefore, 
> 'meters!15' doesn't make sense.

  It does if you have a universal base you are working from. Like 
converting currency you convert most likely from the one currency 
to an intermediate, then the intermediate to your desired 
currency, that way you only have 2 steps and a small table vs 
making the ratios for every possible type.

  So if 1 meter suddenly is say 100,000, then 15 * meter and 
meters!15 / meter (or feet!100 / meters) makes perfect sense!

> 15 * meters, has an output '15 m' which is short for '15 m^1'.  
> The exponent is not shown when it's 1. 15 / meters, has an 
> output '15 m^-1'



More information about the Digitalmars-d mailing list