rebind of const class variables

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 20 06:45:26 PST 2015


ketmar:

> Jonathan explains it very well. i can add the only thing: don't 
> use `const` until you forced to. ;-)

In D use immutable (or const) everywhere you can. Possibly mark 
as immutable everything doesn't need to mutate.


> sure, you can cast `const` away in your code, but using `cast` 
> is a good sign of taking the wrong way.

Casting away a const is quite dangerous in D because if you later 
mutate the data, you will probably have bugs.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list