On Saturday, 15 February 2014 at 10:52:25 UTC, Jonathan M Davis
wrote:
If you want logical const, don't use const or immutable at all.
To do so is
undefined as they require physical constness/immutability. So,
if you want
logical const, you need to indicate constness in some other way
that's not
defined by the language. Pretty much by definition, you can't
have logical
const with const or immutable, because the only way to even
attempt it
involves casts, which means undefined behavior. I'd strongly
advise against
even considering it, let alone trying it.
- Jonathan M Davis
+1.
Shoe-horning D's const into C++'s const is a bad idea. They are
fundamentally different and shouldn't be used the same way.
I like to think D's const exists because of immutable and for
that reason alone.