bearophile wrote:
1) A type system a cost, because it gives rigidity and troubles, but it gives you something back. I I think D const/immutable/pure give you enough back only if you look at them with the eyes of functional programming. This means that their full potential (and return of investiment) will be visible only when a D compiler/implementation will manage multicores efficiently, revealing one of the true advantages of functional programming. It will take some years at best.
While const/etc. has many advantages in concurrent programming, your statement vastly undervalues its primary utility. That utility is it provides the user with a powerful tool with which to understand and reason about his programs.
C++ const does not have either of those utilities. C++ const is an unenforcable convention, and offers no guarantees. Logical constness is a convention, not anything that is statically checkable in C++.
To emphasize, logical constness is simply not a feature of the C++ type system.