Static associative arrays?

Gregor Richards Richards at codu.org
Thu Feb 15 23:07:54 PST 2007


It would be nice to have a static associative array syntax analogous to 
the static array syntax. Something like this perhaps:

char[][char[]] a = [ "a" : "Apple", "b" : "Banana", "c" : "Cantelope", 
... ];

This syntax is unambiguous (though admittedly complex) even for 
arbitrarily complex AAs:

char[int][char[][char[]]] a = [ [ "a" : "b", "c" : "d" ] : [ 0 : 'e', 1 
: 'f' ] ];

It also has the added advantage of being similar to the static struct 
syntax.


To be honest, I don't need static associative arrays desperately, but I 
also don't think I need to explain why it would be useful.

  - Gregor Richards



More information about the Digitalmars-d mailing list