@safe
class Y { }

@safe
class X { }

@safe
class Z
{
    int x;

    this()
    {
        if (typeid(X) == typeid(Y)) x = 1; // Compile Error
        else x = 2;
    }
}

void main() { new Z; }

// test.d(19): Error: safe function 'test.Z.this'
// cannot call system function 'object.opEquals'

Isn't this analagous to saying that the "instanceof" operator
in java endangers the GC?

Is it correct to replace '==' with 'is'?


-Eric

Reply via email to