tiffany352 / rink-rs

Unit conversion tool and library written in rust
https://rinkcalc.app/about
GNU General Public License v3.0
408 stars 28 forks source link

Update to most recent GNU units database #87

Closed yunruse closed 3 years ago

yunruse commented 3 years ago

The GNU units(1) database file used was in 2015; given the SI units redefinition in 2019 following CODATA 2018, this is probably worth including to keep units relevant.

This simply includes definitions.units and currency.units version 3.09, directly pulled from version 2.21 (source code); I have made no edits myself.

Other than general reordering of units, major differences include:

The latter change is a bit of a significant one that may affect the efforts made for #2 and #12: the definitions file no longer has substance namespaces, merely units. As such, I'm not sure if this will break certain behaviours, unfortunately.

I guess an x of y -> yx macro might maintain the backwards compatibility of the syntax — it would make bizarre phrases such as lar of dol technically valid, but I would consider that a charming easter egg :)

yunruse commented 3 years ago

Mm, as expected some build errors. I'm not wholly sure why, but I believe the changing of -- to - in prefixes may have some part to play; it's the only syntax change I can notice. (The removal of substance namespaces per se is just the absence of that syntax, so I'm unsure if that's an issue.)

tiffany352 commented 3 years ago

Rink's definitions file is a fork from the original with a lot of built up modifications over the years. A few that are worth noting include:

I've also had to make various changes, as there are some features in GNU units that are purposefully not implemented in Rink. These include:

I think the direction I want to take is to slowly move to a more original units database tailored for Rink, rather than to continue pulling in changes from original GNU units.

Some of the changes are worth integrating, but this should be done on a case-by-case basis instead of replacing the entire file. For example the updated constants.

yunruse commented 3 years ago

Ah, that makes a lot of sense then.

I’ve developed my own unit library, and it was very frustrating when I was done to see that there was already a de facto standard under my nose. But competing standards can muddy the waters, so I whenever I next update my program I’ll likely gut it out to explicitly support the GNU units file, rather than have yet another competing standard.

In any case, it would be worth making the units files distinct from the GNU units version, both for licensing issues and to make it clear it’s not simply an older version, as I mistakenly believed; my apologies.