-
Notifications
You must be signed in to change notification settings - Fork 24
Propose some functions and macros for unitful integration. #11
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
Conversation
In particular this PR provides a `q_str` macro which accesses `u_str` to define qunatities via the corresponding data in Unitful. I don't know how to define the macros in the extension, so at this stage it would make Unitful a full dependency. IMHO this is ok, but of course this is open for discussion.
Benchmark Results
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
Thanks for the PR! I am in principle on board with this, just need to consider things a bit more. I am wondering whether it makes sense to make Unitful.jl a hard dependency or not. According to the benchmark above, it bumps the load time to 0.6s. After #9, the load time would go down to 0.07s, so this would be a big increase if we do choose that route. @oscardssmith thoughts? I definitely like the idea of exporting a If we break the target audience into two groups, I see the following use-cases:
In talking through this, I wonder if it makes the most sense to just have people import both packages, and convert between them. In other words, maybe it makes sense to keep Unitful.jl as an extension, without the |
@odow I'd be interested to hear your thoughts as well |
Interesting considerations! My opinion here is that Unitful.jl is too rigid to be used by end users (who ase a rule are inexperienced programers and don't see programming as their foremost purpose). For I see the need for being able to expose end users to quantities with units in an easy to handle consistent way, Julia and its ecosystem certainly have the potential, and DynamicQuanties could make it possible. So indeed I would put them first... |
Personally, I don't think DynamicQuantities should support Unitful or have any conversions. I'd also stay away from helper functions and macros for as long as possible. See if people can get used to the |
I feel suggesting that everyone writing their own list of units in their codes using the bare metal API provided by the Quantity/Dimension API would violate the DRY mantra. But in a way this is a matter of taste and the functionality I am proposing could as well be provided by a glue package. |
Ok the wind blew the other direction, so I think we can close this. |
1 similar comment
Ok the wind blew the other direction, so I think we can close this. |
In particular this PR provides a
q_str
macro which accessesu_str
to define quantities via the corresponding data in Unitful.I don't know how to define the macros in the extension, so at this stage it would make Unitful a full dependency. IMHO would be ok, but of course this is open for discussion.
See my proposal in #10 - this PR could be an implementation.