D Language 2.0

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Mon Jan 18 12:03:46 PST 2010


retard wrote:
> Mon, 18 Jan 2010 19:43:54 +0000, BCS wrote:
> 
>> Hello Walter,
>>
>>> Daniel wrote:
>>>
>>>> I also kind of hoped we'd see standard real world unit types in D.
>>>> Like sqft, meters, ohms, kg, L, Hz, seconds,
>>>>
>>>> etc. native to D.  Being able to intrinsically convert types between
>>>> these things would make D the most
>>>>
>>>> approachable General Programming Language for real world problems.
>>>>
>>>>
>>> Here it is:
>>>
>>> // by Oskar Linde Aug 2006
>> It might be a case of NIH, but that doesn't handle fractional units (for
>> example MPa*m^1/2 is used in fracture mechanics and I suspect that they
>> are fairly common as intermediate values in solving equations in odd
>> directions).
> 
> You can fix that by encoding the power of each unit as a fraction. No big 
> deal. That's a good observation, though.

He already did. :)

http://www.dsource.org/projects/scrapple/browser/trunk/units

-Lars



More information about the Digitalmars-d mailing list