To use or not immutable?
Dukc
ajieskola at gmail.com
Wed Dec 9 17:06:14 UTC 2020
On Wednesday, 9 December 2020 at 16:47:43 UTC, Jack wrote:
> Do you use it in your code base? are there some design flaws,
> like there's in C++'s const, which I'm not aware of?
There are downsides, Jonathan Davis has written about them:
http://www.jmdavisprog.com/articles/why-const-sucks.html
But the downside of D's `const` or `immutable` are mainly that
you can't use them everywhere you might wish to. A good rule of
thumb is that if you can get it to pass compilation as `const` or
`immutable` without any hacks, there is no problem going ahead
with it.
More information about the Digitalmars-d-learn
mailing list