On Thursday, 3 May 2012 at 08:00:43 UTC, Namespace wrote:
So, you mean that if i declared any parameter as const, it have to stay const all the time?

Yes. const = you can't change. Changing it is invalid behavior. Imagine const/immutable as bits in readonly memory and you'll have to right mindset.

What would you do, if you need in a special case a mutable version or must change the object itself? Because there is no "mutable" keyword in D you have to cast away the constness.

In what way do you mean? If it's something you honestly _need_ to change and it's const, then maybe throwing an exception would be appropriate.

Reply via email to