-
Notifications
You must be signed in to change notification settings - Fork 123
Add SI, Troy, US Customary unit groups #235
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
fix package location
i have another commit pending for this that adds the new objects from #227 . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really nice. Great work
* Puts [[Dimension]] objects into implicit scope | ||
* so that implicit [[UnitGroup]] machinery works. | ||
*/ | ||
object ImplicitDimensions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a general were question. If we were going to add a new Quantity
would there be compilation errors if the implicit Dimension
isn't defined here? I hope that's the case 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there wouldn't be. You'll get a compiler error if you try to use it, but this file will build just fine. Which is a problem. I'm not sure the best way to address it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd have the same issue if we wrote lots of boilerplate collecting SiUnit
for each Dimension
too, though.
This builds on #234 to start adding unit groups.
There are two SI unit groups, "strict" and "expanded." Strict is just those in the SI itself. Expanded adds hours, minutes, days, liters, and other non-SI units that can be used in the SI, as defined in the BIPM appendix.
I defined the SI using implicits to avoid having a massive file with lots of boilerplate calling
... collect SiUnit si ...
for eachUnitOfMeasure
. In order to getUnitGroup
s implicitly generated, I had to getDimension
into implicit scope, which I did via theImplicitDimensions
object. That's just boilerplate, but at least it's only one per Dimension.