On Thu, Aug 22, 2002 at 02:35:21PM +0200, Josef Hook wrote:
> 
> I've just got a cvaazy idea. Why not have a multihash.pmc, multdimensional
> hashes. I've been going through perlhash code and my multiarray code and,
> as i see it, its doable. Why would we want something like that one
> could ask? One idea is for translation from different languages ex:
> 
>    new P0, .PerlString
>    set P0, "dra ut ansiktet för att se svensk ut"
>    new P1, .MultHash
>    set P1[elongate][the][face][to be][swedish], P0
> 
> 
> Maybe its not the best example i just made it up.
> What needs to be done is copy calc_multi_offset function from multiarray
> and also add an INTVAL to bucket struct that we use for finding correct
> bucket when the hash grows. its all in my head. So what do you all think
> about it? is it cvaaazy or goood.. :-)

What's the benefit of this over a hash of hashes? (or hash of hash of
hashes?)
I think I can infer that a multidimensional array is better than an array
of arrays because it is inherently rectangular, cuboid (etc in 4+ dimensions)
and would use less bookkeeping overhead because

1: you only need to store the dimensions in one place
     (whereas an array of arrays has to store the second dimension in all
      the second level arrays, and additionally an array of array of arrays
      has to store the third dimension in all the third level arrays
      (and there will be first dimension * second dimension third level arrays)

2: you can lay the data out contiguously in memory in a compact, regular way


but I can't see either advantage to a multi hash.

Nicholas Clark

Reply via email to