Want reasonable reference counting? Disable automatic sharing of immutable
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Sun Nov 14 21:36:27 UTC 2021
On Sunday, 14 November 2021 at 20:46:59 UTC, H. S. Teoh wrote:
> C++ const is a joke, I'm not even thinking about it. :-D
Actually, it isn't a joke. Const encourages the programmer to
keep things const, and the compiler can establish it by static
analysis before depending on it. Basically, it means that you
write more code that is "const" than you otherwise might have
done.
It is the same as with "pure" (no globals) in D. If D had made
"pure" the default then programmers would have to think twice
about accessing globals and written more code that is local and
easier to maintain and optimize.
More information about the Digitalmars-d
mailing list