Mixin demo: associative array initializers (with support for

Dan murpsoft at hotmail.com
Wed Mar 14 09:49:42 PDT 2007


Walter Bright Wrote:
> This is pretty cool that you were able to figure out a way to do this. 
> My job is to find a way that you can do such things without it looking 
> horrible <g>.

No offense man, 'cause I have alot of respect and appreciation for what you've done here... but associative arrays are still hugely broken in D.  I have the latest version and I can't seem to use anything to do with them.

I'm thinking I may have to implement my own object setup instead of simply using Value[char[]] since DMD doesn't quite yet live up to the D language spec.

For my needs, I was hoping to use a left-median left-minimum binary search array on the char[] struct.  (x << 1 == goleft, x << 1 + 1 == goright)  It's vastly simpler, and faster than your hash algorithm for most cases < 4096 items, and it maintains cache coherency during a search (progresses left to right (skipping) instead of hopping back and forth like median-median left-mininum binary arrays)

            3
     1            5
   0  2        4  6

order = [3][1][5][0][2][4][6]

Let me know what you think.



More information about the Digitalmars-d mailing list