Comments (5)
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
from unchained.
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.
from unchained.
There are still a few missing! Should be added now that it's as trivial as adding a few select new lines.
from unchained.
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?
from unchained.
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.
from unchained.
Related Issues (14)
- Tests fail on non Nim devel HOT 1
- Degree to Radians conversion fails HOT 1
- Division of (some?) units is broken HOT 1
- UFCS breaks type checking of proc arguments HOT 1
- Add `*=`, `+=` and friends HOT 1
- Math with SI & imperial mix don't convert in some cases HOT 1
- Control the precision of units HOT 12
- Combining unchained and cligen.dispatch results in extremely long compilation HOT 20
- Can't use two generic parameters of the same quantity HOT 3
- `const` variables lose their type information HOT 1
- Add more imperial units HOT 13
- Declarative unit definitions and unit systems HOT 8
- Unit math with certain compounds HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unchained.