D-Programming-Language/druntime — pull request #482 by IgorStepanov (2013-05-05 19:02:18+00:00)
Title: hash and typeinfo refactoring

This is part of #477 pull.
My motivations for this refactoring:
1. Hash calculating is a very dark magic. Different types need a different hash functions. If you want to calculate hash at compile time, you need a CTFE-ready function for this task. (This function must know static types of "hashable" object). If you need to calculate hash at run time, without static type, you must call TypeInfo.getHash. Very impotant, that TypeInfo.getHash and CTFE-ready function use same hash calculating strategy. There is different special cases, which must be take into account. E.g. common types we calculating with hashOf fuction, but hash of int value is a int value. char[] and string uses a special hash algorithm (but const(char)[] not -- I've fixed that.)
Ergo: all hash functions must be placed into single module (and this module must be allowed to end-user).

2. I've made TypeInfo refactoring for fun. All those Ti_Ag classes contains a identical code. Using of templates has allowed to achieve 2.5 ratio (and prevent some errors). I think, using a templates for typeinfos is a right way. In future, we can replace dmd code, which generates typeinfos with template code. It is a solvable problem, now.