On 12/10/2011 12:10 PM, Mehrdad wrote:
On 12/10/2011 3:08 AM, bearophile wrote:
Timon Gehr:
No, popFront is mutating and const(int[]) cannot be mutated.
So, is it impossible by design to iterate immutable collections?
Bye,
bearophile
I believe the answer is yes (although Timon would probably know better).
You can always have a mutable range over the immutable collection contents.
That's one reason I believe const is broken...
Well, you are essentially complaining about the fact that
const/immutable variables cannot be changed. I believe that very likely
this is the point of having them. If you want to mutate a variable don't
make its type const or immutable.