immutable class X
{
   private int x;
   this(int x) { this.x = x; }
   ...
override size_t toHash(); // error: can't override mutable method
}

Since toHash() cannot be overridden in an immutable class,
is there a work-around?

In other words,

immutable X x1 = new immutable X(5);
immutable X x2 = new immutable X(5);

I would like for x1.toHash() to equal x2.toHash(),
but this is not the case because toHash() cannot be overridden.
Note also that (x1 != x2) even though they should be equal (I think...)
Is this a bug or a feature?

-Eric

Reply via email to