Skip to content
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

Make Decimal generic over Uint type #1066

Closed
wants to merge 1 commit into from
Closed

Make Decimal generic over Uint type #1066

wants to merge 1 commit into from

Conversation

uint
Copy link
Contributor

@uint uint commented Sep 1, 2021

Just to give you an idea of what this could look like if we wanted to be DRYer.

The idea is that eventually to implement Decimal<Uint256> we would only need to impl DecimalInnerType for Uint256.

The downside is I don't think Decimal::one or Decimal::zero can be be constant functions anymore because of this: rust-lang/rust#54469

It doesn't look like we can avoid a bunch of breaking changes here, so if we like this I'm thinking I'll wait for 1.0 and for now just create a Decimal256 that's pretty much a copy-paste of Decimal.

@uint uint added this to the 1.0.0 milestone Sep 1, 2021
Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sceptical this abstraction is really needed for the two cases we have. It creates new symbols that need to be documented and tought.

I'd favour a copy/paste solution for Decimal256 now. From there we can see what can be deduplicted.

@webmaster128
Copy link
Member

Removing this from the 1.0.0 milestone. This is nice to have but should clearly not block the release. Decimal and Decimal256 should do everything we want right now.

@webmaster128 webmaster128 removed this from the 1.0.0 milestone Sep 8, 2021
@ueco-jb
Copy link
Contributor

ueco-jb commented May 5, 2022

Does it make sense to keep it open?

@ueco-jb ueco-jb closed this May 5, 2022
@webmaster128 webmaster128 deleted the generic-decimal branch May 5, 2022 19:31
@webmaster128
Copy link
Member

webmaster128 commented May 5, 2022

Good to close this. I think macros are the better tool for what we need here to deduplicate some code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants