On 2/18/2016 9:46 PM, Jonathan M Davis wrote:
On Thursday, 18 February 2016 at 22:40:32 UTC, Walter Bright wrote:
On 2/18/2016 4:16 AM, Jonathan M Davis wrote:
headconst may solve the extern(C++) problem, but it really doesn't solve the
problems we have with const.

'mutable' doesn't really solve a problem, it just means that C++ 'const' is a
documentation aid, not a guarantee.

It's still a guarantee for those members that aren't mutable. It's allowing
casting away const and mutating that totally blows the guarantees out of the
water.

That's why such casts are not allowed in D @safe code.

C++ const does not come with mechanically checkable guarantees, and D's does. This makes all the difference.

Allow @mutable, and no more mechanical checking in D. Recall that D supports opaque types, meaning types are not fully known to the compiler.

Reply via email to