My last mail didn't have many answers, maybe this one makes people think
and give ideas...

--------------------
 RFC: Hashing PMC's
--------------------

Current PerlHash implementation accepts PMC's as keys, as long as they
can be transformed into Strings. While this can be enough for many
cases, having a very complex PMC as key will lead to a recursive
String generation.

A hash table implementation can be easily done from any type to any
other type as long as we can compare that type, and we can generate
some hash from it.

For strings, there are a very wide range of hash functions (from
simple ones to more complicated ones, like MD5).

So, if we want a hash to accept PMC as keys, we have to compare and
hash them. Comparing is already possible as long as PMC classes
implement the correspondent vtable method.

Finally, we need to hash PMC's. While I don't know what hash function
we should use, I can write some goals for it:

1) Different PMC types should lead to different hash values;

2) Hash values should be calculated recursively, within the PMC
nested datatypes;

3) Be quick;

Please, send ideas replying to this e-mail (directly to me or to the list).

Thanks,
 Alberto


-- 
Alberto Manuel B. Simoes
Departamento de Informática - Universidade do Minho
http://alfarrabio.di.uminho.pt/~albie - http://numexp.sf.net

Reply via email to