-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
unit_system
syntax overhaul, support metric prefixes
#44
Conversation
term, this should be handled by the compiler.
… base dimensions as those without right hand side
…y. Dimension -> BaseDimension, Quantity -> Dimension
…ensions to use a hashmap
…ick when unknown identifiers are used in annotations, instead emit a proper error message
…unit conversion methods are generated
undefined idents
//TODO(minor): Support using ° here. | ||
#[symbol(deg)] | ||
#[alias(degrees)] | ||
unit degree: Angle = PI / 180 * radian; |
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.
unit degree: Angle = PI / 180 * radian; | |
unit degree: Angle = 180 / PI * radian; |
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.
As confusing as it is, degree = PI / 180 * radian
is the correct definition. It feels really weird because it seems like it's multiplying radian with PI (which it already contains), but a degree is less than a radian, so PI / 180
is the correct factor.
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.
Gosh, never underestimate the power of covariance/contravariance to confuse. I don't know why it looked natural for the others, but jarring here. Sorry about the noise.
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 worries! When I saw your change request I was completely convinced that you were right and that the code was wrong, so I made exactly the same mistake. Thanks for looking through the definitions so thoroughly!
… terms of aliased/prefixed units
…fined at most once per dimension
Solves #18