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

Should we have Java-like hash codes? #16

Open
neocotic opened this issue May 10, 2017 · 0 comments
Open

Should we have Java-like hash codes? #16

neocotic opened this issue May 10, 2017 · 0 comments

Comments

@neocotic
Copy link
Member

When I first decided to create Nevis, I really wanted to see if I could recreate Javas hashCode, equals, and toString methods in JavaScript. I even went as far as to try and get the resulting hash codes as close as possible. However, the Java hashCode implementation can only return a 32-bit signed integer. Basically, it has a much smaller maximum value than an integer in JavaScript and, since hashCodes can generally be very large numbers, Java squeezes them down to fit into a 32-bit signed integer.

My question is; should we try to do the same, as we are now, or simply use the larger values? What are the pros and cons?

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

No branches or pull requests

1 participant