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

Add remaining derived SI units #3

Open
Vindaar opened this issue Feb 22, 2021 · 5 comments
Open

Add remaining derived SI units #3

Vindaar opened this issue Feb 22, 2021 · 5 comments

Comments

@Vindaar
Copy link
Member

Vindaar commented Feb 22, 2021

A decent summary on Wikipedia: https://en.wikipedia.org/wiki/SI_derived_unit

Definitely have to add all remaining derived SI units (things like Tesla, Radian etc. are still missing).

Maybe a good idea to also add some of the quantities listed in the examples section. While we shouldn't enforce distinctness there maybe (e.g. then m⁻¹ is of an unclear quantity all of a sudden), it would be handy to be able to refer to Wavenumber and have that match anything that is of inverse length.

@Vindaar
Copy link
Member Author

Vindaar commented Jul 27, 2022

There are still a few missing! Should be added now that it's as trivial as adding a few select new lines.

@arkanoid87
Copy link

I wonder if it's worth rewriting and updating the units

have you ever considered parsing one of these?

frinklang
https://frinklang.org/frinkdata/units.txt

gnu-units
https://github.com/ryantenney/gnu-units/blob/master/units.dat

@Vindaar
Copy link
Member Author

Vindaar commented Jun 22, 2023

Yes, one could certainly parse one of them and generate the correct declarative macro code from it.

However, compilation is already not exactly fast. If one had a file of all those units compilation speed would be pretty bad I think. It would be nice to have a submodule "all_units" or something like that, sure.

Generally, the vast, vast majority of these units is simply unnecessary. The point is that unchained already provides the facility to generate your own set of units for users that actually need to deal with different kinds of units than standard SI units (e.g. I saw units for paper sizes and weights in one of your linked files). That's great. Feel free to write your own little file, in the same way as in the example for a custom unit system https://github.com/SciNim/Unchained/blob/master/examples/custom_unit_system.nim.

I'm completely open to even adding useful unit systems (and of course generally regular units) to the repository. Just create a PR! I'm just not (for the time being) going to add an almost infinite number of units that likely no one is ever going to use.

A more important piece of work in my opinion is finishing my local code to handle separate unit systems at the same time and do correct conversions between them.

@arkanoid87
Copy link

I find myself often copypasting the original file just to add a couple of quantities or units.

I tried to import the original file and create a new declareQuantities and declareUnits statements, but it clearly doesn't seem to work that way

What about enabling this "append" pattern to get the best of both words?

@Vindaar
Copy link
Member Author

Vindaar commented Mar 21, 2024

I'd need to check if "appending" from another module could work correctly. There's a chance the current macro logic would fail in that case.

Otherwise: I'm always open to add actually useful other units! I just would like to avoid to add a huge number of units that hardly anyone will ever use. So if you have a list of things that you consider essential, feel free to tell me / create a PR for them.

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

No branches or pull requests

2 participants