Improve the OOP ABI
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Mon Jan 22 20:57:32 UTC 2024
On 23/01/2024 9:46 AM, Walter Bright wrote:
> On 1/22/2024 2:08 AM, Andrea Fontana wrote:
>> Why md5 and not a faster method?
>
> Md5 has an extremely remote chance of two class names hashing to the
> same value. Some people have argued this is unacceptable, though I opine
> that the odds are so low they are unimaginable to humans.
>
> A replacement that has a perceptible collision rate will be unacceptable.
>
> This is not a hash backed up by a string compare. The hash has to be a
> substitute for the string compare.
Quite a few months ago I discussed this problem for class comparison and
proposed the hash to deadalnix.
But not as a substitute for the string comparison, but as a limiter for
how often it needs to be done.
The string comparison is the only way to do the comparison reliably. You
can't use the pointers nor do the string comparison all the time, too
expensive.
So by doing the hash comparison of say an int, we can reliably determine
if it not a match and fail fast. Sadly no way to success fast without
potential problems, which is what you seem to be hand waving the
possible problems for so it'll be fast success.
More information about the Digitalmars-d
mailing list