5 ms·
> in practice, nobody will use a hash function that returns a constant integer How much do you want to bet on that?
by mnw21cam 5y ago
> in practice, nobody will use a hash function that returns a constant integer
How much do you want to bet on that?
- nomemory 5y agoI consider myself an optimist.
- michaelcampbell 5y agoNot 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.
- nomemory 5y agoMaybe it was even more terrible, because it tried to be "smart".
- bruce343434 5y agoyes, 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 https://news-web.php.net/php.internals/70691 Also fun read: https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/
- jkaptur 5y agoI 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.
- omegalulw 5y ago> 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.