Closed jkrumbiegel closed 11 months ago
I didn't add n
for grams yet but we can definitely add it. To do this we simply change this line:
and add n
.
If you see the available prefixes: https://github.com/SymbolicML/DynamicQuantities.jl/blob/e5f4305829eac76864720dfdb0b051c29c9ca2b7/src/units.jl#L54-L60
you can see most combinations don't exist – I basically just didn't want to blow up the list of symbols until someone actually has a need for them (e.g., I don't think people use kilosecond (?), so I didn't add ks
). But since you do have a need for ng
, let's add it!
We also use picograms
, so we could add that, too. kilosecond
, I agree, is not common. But in pharmacology, small quantities are pretty common.
This @add_prefixes
macro cannot be called dynamically, right? If we had the need for special combinations you don't want to add, would we be fine copying the unit code with our modifications for our own dimensions type? Is that how the system is intended?
No, it would have to be internal to the library – @add_prefixes
cannot be called later. But I really don't mind adding it! I just wanted to play it by ear and not add units until people asked for them, since I don't know what units are common in which fields.
I'm also thinking of ways we could enable libraries to add more units upon loading... I'm not sure if such a strategy is dangerous or not.
Symbolic units have milligrams and micrograms, but for example not nanograms.
I could not determine from the docs if this system is extensible, or whether one would have to define their own units to add nanograms (and how to do that).