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

-- 
Кто везде - тот нигде.

Reply via email to