On 9/4/2018 12:59 PM, Timon Gehr wrote:
 [...]

Thanks for the great explanation! Not sure I thoroughly understand it, though.

Therefore, D immutable/pure are both too strong and too weak: they prevent @system code from implementing value representations that internally use mutation (therefore D cannot implement its own runtime system, or alternatives to it), and it does not prevent pure @safe code from leaking reference identities of immutable value representations:

pure @safe naughty(immutable(int[]) xs){
     return cast(long)xs.ptr;
}

(In fact, it is equally bad that @safe weakly pure code can depend on the address of mutable data.)

Would it make sense to disallow such casts in pure code?

What other adjustments would you suggest?

Reply via email to