December 09, 2020
I'm coding with visual studio code and now it shows a yellow mark on variables that is never modified and that could be marked as const or immutable. I think that makes sense, so I think I'll be using it. 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?
December 09, 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.