const or immutable?
Timon Gehr
timon.gehr at gmx.ch
Wed Sep 22 20:48:56 UTC 2021
On 22.09.21 22:06, Ali Çehreli wrote:
> Please excuse this thread here, which I know belongs more to the Learn
> forum but I am interested in the opinions of experts here who do not
> frequent that forum.
>
> tl;dr Do you use 'const' or 'immutable' by-default for parameters and
> for local data?
>
> ...
No. I think `const` and especially `immutable` are great for plain old
data types, especially data that has multiple references to it. For
non-trivial user-defined data types, I think just using proper
encapsulation is usually sufficient and more flexible.
More information about the Digitalmars-d
mailing list