On Monday, 21 June 2021 at 10:34:51 UTC, Andrea Fontana wrote:
> Can't we add the metric prefix as alternative?
Please no. I agree that the current list is not the most consistent or easiest to remember, but the current error message is actually really informative:
Error: template instance core.time.dur!"millis" does not match template declaration dur(string units)(long length)
with units = "millis"
whose parameters have the following constraints:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> units == "weeks"
or:
> units == "days"
or:
> units == "hours"
or:
> units == "minutes"
or:
> units == "seconds"
or:
> units == "msecs"
or:
> units == "usecs"
or:
> units == "hnsecs"
or:
> units == "nsecs"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adding a bunch of synonyms makes things more complex. Whenever there are multiple alternatives for something, it spawns questions like "are there differences" and "which is the preferred one" which you simply don't have with one name per unit.
> 20.dur!"µs" <-- (altgr+m on my linux keyboard)
Next thing someone wants "us" to be consistent with "usecs". Also let's add "secs" and "useconds" and "µseconds". Once there's precedent for synonyms, it can easily get out of hand.
> We should add also non-SI abbrevetion for other common accepted units like:
1.dur!"m"
1.dur!"h"
1.dur!"w"
m = months and w = weeks? I'm familiar with m = meter or milli, but m = month is not obvious to me.