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

Do not use generic when not needed in traits #533

Closed
haerdib opened this issue Apr 13, 2023 · 0 comments · Fixed by #534
Closed

Do not use generic when not needed in traits #533

haerdib opened this issue Apr 13, 2023 · 0 comments · Fixed by #534
Assignees
Labels
F7-enhancement Enhances an already existing functionality

Comments

@haerdib
Copy link
Contributor

haerdib commented Apr 13, 2023

Currently, there are a lot of generic and associated types mixed in our traits, as @clangenb once pointed out (forgot where that was though).

Current logic: Return types are associated, input types are generic. Nothing wrong with that, but there's one drawback though: Generics are more verbose, which makes #500 more difficult than it needs to be.

Because most traits do not need to be generic (I don't see the use case of multiple implementations for different Hash types for example), I propose to make them associated instead of generic.

Good explanation on associated / generic difference: https://blog.thomasheartman.com/posts/on-generics-and-associated-types/

@haerdib haerdib added the F7-enhancement Enhances an already existing functionality label Apr 13, 2023
@haerdib haerdib assigned haerdib and unassigned haerdib Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F7-enhancement Enhances an already existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant