How to make a global immutable associative array?

Dan Killebrew danielk.misc at gmail.com
Tue Mar 18 17:54:01 PDT 2014


On Wednesday, 19 March 2014 at 00:37:27 UTC, bearophile wrote:
> Dan Killebrew:
>
>> Seems unintuitive and roundabout. Is this a bug or a feature?
>
> It's a good feature. Generally immutable variables are 
> initializable from strongly pure functions. If you think about 
> what immutability and purity mean, it's a good match.
>
> Bye,
> bearophile

I meant something else. Why doesn't this work:

immutable int[int] aa = [1:2,3:4];

Seems like it should work to me. After all, this works:

immutable int[] a = [1,2,3,4];

So how is the second 'more constant' than the first? The fact 
that the first code block does not compile seems like a bug.


More information about the Digitalmars-d mailing list