On 12/20/2013 03:04 PM, Timon Gehr wrote:

The DIP breaks some existing, perfectly valid code without any clear way
to fix it.

const(int)* foo(...){ ... }

class C{
     int* a;
     this()const{
         a = foo(...); // error
     }
}

The actual workaround will be:

class C{
    int* a;
    private this(inout(int)* foo_result)inout{
        a = foo_result;
    }
}

const(C) constructC(){ return new C(foo(...)); }
// or 'new const(C)' ? If so, how to add a const constructor
// without breaking the workaround?

Reply via email to