Standalone AA implementation ready for review (Was: Re: Replacing

bearophile bearophileHUGS at lycos.com
Wed Mar 14 17:05:38 PDT 2012


H. S. Teoh:

> - As mentioned above, wstring or dstring keys (in fact any array keys
>   with literals that doesn't default to the key type) need an explicit
>   suffix when indexing with literals. I haven't figured out how to make
>   this work yet.  At the very least, wstring and dstring needs to
>   support suffixless key literals; it would be nice if a general
>   solution could be found for all array-typed keys.

This might be a problem worth fixing generally, if possible, so it's solved for other library-defined collections too.


> I'm also
>   seriously considering forcing *all* AA keys to be immutable, in which
>   case this will become a non-issue.

I am for not mutable keys.


> - Some code (most notably that table of primes that I hoisted from
>   aaA.d) may need to be refactored to prevent excessive code bloat when
>   the AA template is instantiated.

Ah, another usage for my "static static" (or for the @templated()). I'll count how many times they come out useful :-)


> It would also be
>   nice if there was a uniform syntax for getting the hash of a type
>   without going through typeid (may be more efficient?).

I agree!


> - I haven't stress-tested AA performance yet. (Any volunteers? ;-))

I have several benchmarks, but you can start quickly adapting this one, comparing the performance of the built-in AAs with your ones:
http://rosettacode.org/wiki/Sokoban#D

Bye,
bearophile


More information about the Digitalmars-d mailing list