logoalt Hacker News

zabzonk12/08/20243 repliesview on HN

Have functions with different names and different numbers of parameters?


Replies

Sesse__12/08/2024

And then have a union between the two different kinds of pointers, and a tag to tell which one is in use, then test that tag everywhere? Why? What good does it bring for that extra complexity?

show 1 reply
detaro12/08/2024

The point is that you can pass any of the hash functions (or your own compatible) to the datastructure, so it'll obviously call of them with the same set of parameters. And hash functions that need all of them will ignore them.

saagarjha12/08/2024

That would be a bad API design.