thedeemon wrote: > On Thursday, 27 February 2014 at 10:12:46 UTC, Jens Mueller wrote: > >As you may conclude from this post I find this behavior odd. I > >expect a > >hash implementation to follow indirections by calling the hashing > >functions recursively. > > How shall it work with cycles in object graphs?
That's probably the rational behind the implementation. Probably also the reason why Tuple and VariantN implement no toHash, i.e., it is impossible to provide an efficient implementation for toHash for some generic types. But the consequences are rather dramatic because whenever I need hashing for a type (with indirections but no cycles are created at runtime) I must implement my own types because generic ones cannot provide it. It may be useful to provide a generic hash function for these cases in Phobos. Jens
