Giter VIP home page Giter VIP logo

Comments (5)

arkanoid87 avatar arkanoid87 commented on May 20, 2024 1

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.

Vindaar avatar Vindaar commented on May 20, 2024 1

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.

Vindaar avatar Vindaar commented on May 20, 2024

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

from unchained.

arkanoid87 avatar arkanoid87 commented on May 20, 2024

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.

Vindaar avatar Vindaar commented on May 20, 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.

from unchained.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.