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

All types should support the visitor pattern used by hash() #185

Open
koraa opened this issue Apr 30, 2021 · 0 comments
Open

All types should support the visitor pattern used by hash() #185

koraa opened this issue Apr 30, 2021 · 0 comments
Labels
breaking-change This is a tag for issues whose implementation needs a new major version enhancement New feature or request needs-api-design

Comments

@koraa
Copy link
Contributor

koraa commented Apr 30, 2021

hash() uses a visitor pattern so users can customize how hashing should be performed and can even supply hashers that use heuristics.

We should extend this pattern to all traits. E.g. eq() should use a hasher should just use itself as the visitor but could take arbitrary others. This way we could implement a lot more complex comparisons; let users customize the function per type, even add heuristic equality comparison.

Other features could use a simplified implementation; e.g. we could unify shallowclone and deepclone (deepclone is just a clone with itself as the visitor, shallowclone is just a clone with the identify function as visitor).

@koraa koraa added enhancement New feature or request needs-api-design breaking-change This is a tag for issues whose implementation needs a new major version labels Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This is a tag for issues whose implementation needs a new major version enhancement New feature or request needs-api-design
Projects
None yet
Development

No branches or pull requests

1 participant