On Friday, 18 November 2022 at 11:51:42 UTC, thebluepandabear
wrote:
A question I have been thinking about whilst using D is how
often I should be using const.
Many people claim that all variables should be const by
default, but whether or not it is really needed is debatable
and oftentimes making everything const could cause readability
issues and make the code more complex.
I also wonder how important const really is, like 99% of the
time you will know when your variable will be changed, and even
when a variable changes it's not like it is the end of the
world.
Also, there is no real end to how much variables can be const.
Oftentimes -- interestingly -- in popular repos I don't even
see const being used, this is what confuses me.
As a newcomer, I'd be interested in hearing everyones thoughts.
Some languages like Kotlin and Rust are const by default, but for
languages that are not like D I have always wondered how often
you should use const.