Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> in practice, nobody will use a hash function that returns a constant integer

How much do you want to bet on that?



Not quite that bad, but the hash algo for ... function lookup? (the exact usage escapes me) in PHP was "strlen". Yup, the length of the function name was the hash value.


yes, the early php stdlib functions sometimes had mangled names by replacing a "to" with 2, and maybe shortening some names but not others due to this reason. At least, that's what the creator of php says here: https://news-web.php.net/php.internals/70691

Also fun read: https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/


Maybe it was even more terrible, because it tried to be "smart".


I did this many years ago. It wasn't production code and I was prioritizing expediency. The class had rather complicated equals() semantics, I wanted "set" and "map" data structures, and I knew there would never be very many objects.


> How much do you want to bet on that?

Isn't it a rather safe bet since most people won't roll their own hash functions anyway.


I consider myself an optimist.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: