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

hash function in modules Bool/Int/Char/String #10259

Closed
backtracking opened this issue Mar 2, 2021 · 3 comments · Fixed by #11246
Closed

hash function in modules Bool/Int/Char/String #10259

backtracking opened this issue Mar 2, 2021 · 3 comments · Fixed by #11246

Comments

@backtracking
Copy link

backtracking commented Mar 2, 2021

It would be convenient if modules Bool/Int/Char/String would provide a hash function, so that we can pass them to functors such as Hashtbl.Make.

Of course, we can use the polymorphic hash function Hashtbl.hash for this purpose, or define custom hash function (e.g. the identity for type int), but that's less convenient from a user's perspective.

Note: module Float already provides a hash function.

@backtracking backtracking changed the title hash function in modules Bool/Int/Char/String/Float hash function in modules Bool/Int/Char/String Mar 2, 2021
@dra27
Copy link
Member

dra27 commented Mar 2, 2021

Cross-referencing at least https://github.com/ocaml/ocaml/pull/8878/files (String.hash)

@xavierleroy
Copy link
Contributor

See my comment here: #10262 (comment) . There's a tension between seeded and unseeded hash functions, and bad name choices in the past prevent us from implementing both in the same module.

@github-actions
Copy link

github-actions bot commented Mar 4, 2022

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

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