Closed stijnfrishert closed 2 years ago
hey @stijnfrishert thank you for the contribution!
Yes, that definitely makes sense! IIRC most of that API surface was written before const fn
became a stable language feture, so there are no actual reasons for them to be in runtime.
Before releasing the patch, we'll go over the codebase and try to find other places that should be const
.
Thanks! Much appreciated. 😄 Was hoping I could get the regular new()'s const too, but they're not const in num::Ratio as well (due to gcd and whatnot).
Looking forward to the patch 👍
@stijnfrishert thanks again for the contribution! This patch is a part of the 0.12.0
release.
We also made some other functions const throughout the codebase.
@dnsl48 Much appreciated :)
Hey,
In my personal work I'm using
Fraction
to represent musical rhythmic values, and I would very much like to create some const variables for commonly used values. I can't, becauseFraction::new*()
isn't const.I've created a fork where I made
new_raw*()
const (andnumer()
,denom()
andsign()
while I was at it). Can't do so withnew()
becausenum::Ratio::new()
isn't const.If you're ok with it, I would love to merge at least the const raw variants in.