So… I’ve been trying to understand hash functions better, and so I was passing random stuff into Hashtbl.hash.
Apropos of nothing, I tried passing functions into Hashtbl.hash
to see what would happen, and found that some functions produce new hashes every time and some produce the same hash every time, which piqued my curiosity. I noticed I could also observe this by testing a function for physical equality with itself. (Also it’s fun to make ascii robot faces like (+) == (+)
in utop.)
I promise I’m not going to use this knowledge for anything (), but why are some functions physically equal to themselves and some aren’t? My only guess is that ones that aren’t equal are being inlined on use, but I have no idea.