iliekturtles / uom

Units of measurement -- type-safe zero-cost dimensional analysis
Apache License 2.0
1.03k stars 98 forks source link

Teaspoon & tablespoon have US sizing #282

Open OJFord opened 2 years ago

OJFord commented 2 years ago

I suppose fluid_ounce being US (vs. fluid_ounce_imperial not) is fair enough, I might be inclined to do the opposite being British.

In the case of teaspoon & tablespoon though I think it's confusing - as far as I know the standard measurement is metric: 5ml & 15ml respectively.

This doesn't exist in uom::si, nor does teaspoon_imperial or tablespoon_imperial (the former 1/3 of the latter, as in the US ones, and tablespoon_imperial 5/8 of a fluid_ounce_imperial, unlike the US one at 1/2) which might hint at them not being metric at least.

IMO teaspoon and tablespoon should be metric, and US/imperial variants should all be suffixed if they're to be provided.

iliekturtles commented 2 years ago

I wasn't aware of the difference between an US teaspoon and metric teaspoon and just used the NIST reference. The hardest part of adding a metric tea/tablespoon will be deciding on the names. I'm not against breaking compatibility in general, but I'm hesitant in this case because the effect would be very subtle so I'm leaning towards something like teaspoon_metric.

For reference I live in the US and decided to use the US option when one must be chosen.

https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors/nist-guide-si-appendix-b9#VOLUME

OJFord commented 2 years ago

Interesting, I wonder why it's missing there when it seems so complete otherwise.

Maybe a good general (& backwards-compatible) solution is to always suffix them when there's any ambiguity? i.e. _metric, _us, _imperial in all such cases; deprecating the unsuffixed version?

(Just looking at that doc, the same occurs with 'cups', US/metric/old British cups are each slightly different. Though that's less likely to ever cause an issue, since cups are so much less used outside the US.)

iliekturtles commented 2 years ago

I think your idea of using the suffixes + deprecation is the way to go. PRs welcome, even if just for the specific _metric or _imperial units you're looking for. Not sure how soon I'll be able to dig in to this.

OJFord commented 2 years ago

Sounds good, will have a look this weekend. Thanks!