Git Product home page Git Product logo

Comments (3)

MilesCranmer avatar MilesCranmer commented on June 11, 2024 2

Hey @briochemc,

Just to let you know we are now also adding the behavior you requested in #98. i.e.,

using DynamicQuantities: m, s
v = 3m/s

will work after that PR merges.

Note that you can still use using DynamicQuantities.Units: m, s if you prefer. Also note that using DynamicQuantities.Constants: c is still required for constants.

Regarding your question about symbolic units: you can do Quantity(1.0, SymbolicDimensions(m=1)) for meters and Quantity(1.0, SymbolicDimensions(s=1)) for seconds. However you can not explicitly import them (yet). This is because those symbols are lazily loaded at first call to the @us_str macro, because they take about half a second to load.

In the future I think it would be nice to have this though. We need a way of declaring an immutable SymbolicDimensions so this can work.

Cheers,
Miles

from dynamicquantities.jl.

MilesCranmer avatar MilesCranmer commented on June 11, 2024 1

You can currently do

using DynamicQuantities.Units: m, s

but maybe I could put the units in DynamicQuantities if that's better? Let me know and I can add it.

The only reason I didn't was to avoid polluting namespaces, and also to avoid name collisions between DynamicQuantities.Constants and DynamicQuantities.Units.

from dynamicquantities.jl.

briochemc avatar briochemc commented on June 11, 2024

Oh I did not know about this and I think that's good enough!

Side (but related) question: How does one do the same thing for symbolic units?

from dynamicquantities.jl.

Related Issues (20)

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.