-
Notifications
You must be signed in to change notification settings - Fork 95
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
q[m / s]
or q.in(m / s)
#469
Comments
|
Well, we can also use |
BTW, there is one more important difference in behavior between |
IIRC, the proponents of |
On the other hand, |
First, I would like to state that I personally love the syntax that creates a
reference
based onquantity_spec
andUnit
:I wouldn't like to make the above gone.
However, yesterday I wrote the following example in our documentation:
Initially, I provided this operator to entertain myself with this idea and for consistency with the above. However, there are a few significant differences here:
isq::height[m]
is a pure compile-time operation with no runtime overhead. It also never touches the quantity value.q[m]
, of course, creates a new type in compile-time but also involves a runtime value rescaling operation according to the provided new unit. It can also lead to overflows or losing the precision of a quantity value.Even more, we now have a
q.number_in(si::metre)
(#412), which returns a raw value in a provided unit.So here comes the questions:
q.in(si:::metre)
to express runtime behavior and for consistency withnumber_in()
?q[si::metre]
?The text was updated successfully, but these errors were encountered: