Static initialization of associative arrays

Chris Piker chris at hoopjump.com
Thu Mar 11 19:26:33 UTC 2021


On Thursday, 11 March 2021 at 19:12:34 UTC, H. S. Teoh wrote:
> On Thu, Mar 11, 2021 at 06:06:35PM +0000, Chris Piker via 
> 	immutable int[string] aa;
> 	shared static this() {
> 		aa = [ "abc": 123, "def": 456, /* ... */ ];
> 	}

Hi H.S.T

Yes, I'm using static if, but do you know if direct 
implementation of immutable associative array assignment (as 
given on the language spec page) will be implemented at some 
point?

This is not a make-or-break feature that I need, just an 
opportunity to gain meta-information.  The actual problem is easy 
to work around, I'm mostly asking out of curiosity to learn more 
about the D ecosystem and how it functions.

Thanks,




More information about the Digitalmars-d-learn mailing list