unit type for addition to std lib [was Re: D Language 2.0]

Simen kjaeraas simen.kjaras at gmail.com
Wed Jan 20 01:38:12 PST 2010


On Wed, 20 Jan 2010 03:47:58 +0100, BCS <none at anon.com> wrote:

> Hello SiegeLord,
>
>> BCS Wrote:
>>
>>>> Also all of the imperial units that I don't care about, as well as
>>>> the more obscure physical units.
>>>>
>>> My lib has every SI unit I could fine and all the units I found that
>>> I recognised. The current vertion can have a new unit added as a
>>> single line of code.
>>>
>> SI has 7 base units, your library has only 5 of them. You are missing
>> luminosity (candellas) and amounts (moles).
>>
>
> They would be easy to add.
>
> That said All the other type systems (CGS, MKS, imperial, etc.) only  
> have those 5 and I find claiming the the last two are base units just a  
> bit silly (candelas are defined in terms of power, stradians and an  
> arbitrary curve and moles are a count). I left them out in protest but  
> I'll add them if anyone cares enough to make much of an issue of it.

I can see reasons to add the Candela (though it is simply a function of
other units, it is not as simple as an SI derived unit), but the mole is
merely the Avogadro constant.
I'd vote for this solution:

enum Mole = 6.022_141_79e23;
enum MolarMass = OfType.gram( 1 / Mole );

-- 
Simen



More information about the Digitalmars-d mailing list