Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to most recent GNU units database #87

Closed
wants to merge 2 commits into from

Conversation

yunruse
Copy link

@yunruse yunruse commented Feb 26, 2021

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 SI (2019) redefinition of base units;
  • CODATA 2018, and the addition of several data sources;
  • All x of y substance properties are replaced with bare yx names (eg density of water -> waterdensity)

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 :)

Has some significant changes since 2015, especially considering 2019 SI unit redefinitions.
I didn't include this as I believed a lot of definitions were destroyed – they'd just been moved to `definitions.units`.
@yunruse
Copy link
Author

yunruse commented Feb 26, 2021

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
Copy link
Owner

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:

  • Categories.
  • Documentation strings (??).
  • The two different prefix types that are used in the parser.
  • Substances.
  • Live currency data.
  • Molecular formulas.

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:

  • Character set / language pragmas, and most of the original pragmas in general.
  • Lookup tables. These are used for things like ring sizes and have a complex syntax that I never implemented.
  • Some minor parts of the expression syntax have been changed.

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
Copy link
Author

yunruse commented Feb 26, 2021

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.

@yunruse yunruse closed this Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants