-
Notifications
You must be signed in to change notification settings - Fork 855
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
[Discussion] Refactor the Decimal
s by using constant generic.
#2001
Comments
cc @viirya. Looking forward to your opinions. |
related to #1999 |
Oh, I have considered generic. But as I cannot use 16, 32 as generic parameter, I don't go for this direction. |
Why can't 16, 32 be used as generic parameter? Rust has supported |
didn't you already say it is unstable feature? |
Oh, that's |
Sorry for the confusion. #![feature(const_generic_exprs)]
impl<const BYTE_LENGTH> Decimal<{BYTE_LENGTH}> // const generic is stable
where {BYTE_LENGTH == 16 || BYTE_LENGTH == 32} // const generic expr is unstable
{...} This is just an alternative way to implment Decimal, DecimalArray and DecimalArrayBuilder. |
Not fully thought through, but you could maybe do something like
|
I believe I remember that I looked at arrow2 for some inspiration but it appears to only support |
Thank you for everyone's discussion! 😀 |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
This is actually a question or a discussion.
Our current may to implement
Decimal128
andDecimal256
is:Actually I find an alternative way to implement this:
I am not sure which one is better, but these are some pros and cons I thought:
pros: don't need the basic trait, reducing using macro when coding (better debugging)
cons: cannot restrict the bit_length to be 128 or 256 because
const_generic_exprs
is an unstable feature.The text was updated successfully, but these errors were encountered: