On 2/19/2016 4:38 AM, Jonathan M Davis wrote:
Yes, as long as you have the source code, finding @trusted violations is _way_ easier in D than it is in C++, but the fact that it's possible to cast away const and mutate still means that the compiler can't actually guarantee that an object is not mutated via a const reference to it.
All languages that guarantee safety have this issue - Rust and C# have 'unsafe' blocks, and Java has the JNI C interface. Even Haskell has its Foreign Function Interface.
The idea is to encapsulate such, which D does as well as any other language. This is not a defect of D.
This does not work for opaque types.Why not? I would expect the opaque type to have to have it too, e.g. @mutable struct S;
That would mean you're proposing '@mutable const' as a type constructor, which you'd earlier said otherwise.
