In C++ we have const correctness in some way. A compiler can make optimizations whenever it doesn't find a const_cast and the mutable specifier marks members that aren't a part of the object state. Of course, it's not perfect but one can document their intentions and it's possible to use synchronization primitives without an issue. On the opposite side, D has a stricter (transitive) const and it's almost useless in many cases. Is there an article that explains best practices of using const in D? The statement "In C++ const isn't transitive so we fixed that." alone isn't convincing. The only way I see right now is omitting the const keyword completely which is ridiculous.

Reply via email to