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.

Reply via email to