All right, all right! Interim decision regarding qualified Object methods
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Jul 12 07:44:02 PDT 2012
On Thu, Jul 12, 2012 at 12:59:16AM -0700, Jonathan M Davis wrote:
[...]
> 1. Anything which wants to be able to operate on Objects generically
> (e.g. have a container full of Objects) is going to have problems,
> since comparison and hashing won't work anymore. For the standard
> stuff, at minimum, that will screw up being able to put Object in AAs
> and RedBlackTree. For 3rd party containers which decided to go the
> Java route of containing Objects, they risk being completely screwed.
[...]
What about adding this to object.di:
class Hashable : Object {
int opCmp(Hashable h) @safe const { ... }
bool opEquals(Hashable h) @safe const { ... }
hash_t toHash() @safe const { ... }
}
Whatever objects need to be put in AAs can just inherit from Hashable.
Or will this introduce more problems than it solves?
T
--
Кто везде - тот нигде.
More information about the Digitalmars-d
mailing list