AAs

Rainer Deyke rainerd at eldwood.com
Wed Apr 8 20:19:45 PDT 2009


bearophile wrote:
> Immutable associative arrays may even define a toHash (computed only
> once, the first time it's needed), so they can be used as keys for
> other AAs/sets too.

How would this work?

Hash value calculated on conversion to immutable?  Messy special case,
plus the hash value may never be needed.

Hash value calculated on first access and stored in the AA?  Can't do,
AA is immutable.

Hash value calculated on first access and stored in a global table?  The
global table would prevent the AA from being garbage collected.

I would like to see this happen, but I don't think D allows it.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list