You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose adding a dependency to Unitful.jl based on a new trait package EnergyTraits.jl. As a proof of concept, these traits allow functional dispatch on the units involved in the equation E = h * nu = h * c0 / lambda.
I have yet to register this package, because I want to see what the feelings over here are. Part of my idea of making EnergyTraits potentially so powerful is having it work with units out of the box. To that end, I have tried to make the package as lightweight as possible (no dependencies, 1 function, 3 types) and I've created a function that automatically tests the trait interface, so actually adding the code should be very easy.
I'm not positive how the dimensions cascade (i.e., while they always simplify?). If so, would the above lines be sufficient for all the units? It works in the example in that test file, so I'm eager!
So, would this be a welcome effort in Unitful.jl? I am happy to make the necessary PRs, and add any documentation requested. Thanks for your time!
The text was updated successfully, but these errors were encountered:
After some good discussion with @aplavin on Slack, it seems like a better solution overall for the ecosystem would be a separation of the dimensions and the quantities in unitful (ref #359).
If there was a package like UnitfulDimensions that was pretty light and just contained the dimensions, dispatching on things like frequency or length could be achieved without 100% buy-in to Unitful, as well as simplifying dependencies. In fact, this whole trait system could be incorporated into such a package just to offer multiple styles of dispatching on dimensions.
I propose adding a dependency to Unitful.jl based on a new trait package EnergyTraits.jl. As a proof of concept, these traits allow functional dispatch on the units involved in the equation
E = h * nu = h * c0 / lambda
.I have yet to register this package, because I want to see what the feelings over here are. Part of my idea of making EnergyTraits potentially so powerful is having it work with units out of the box. To that end, I have tried to make the package as lightweight as possible (no dependencies, 1 function, 3 types) and I've created a function that automatically tests the trait interface, so actually adding the code should be very easy.
What would the changes look like?
Well, I took a stab at this already in this snippet https://github.com/JuliaAstro/EnergyTraits.jl/blob/d21a2c46cb430ebc6c758937a1f469bfa046bb5f/test/runtests.jl#L7-L9
I'm not positive how the dimensions cascade (i.e., while they always simplify?). If so, would the above lines be sufficient for all the units? It works in the example in that test file, so I'm eager!
So, would this be a welcome effort in Unitful.jl? I am happy to make the necessary PRs, and add any documentation requested. Thanks for your time!
The text was updated successfully, but these errors were encountered: