Re: [RFC] Using objects as keys

From: Date: Thu, 30 Oct 2014 23:10:59 +0000
Subject: Re: [RFC] Using objects as keys
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-78496@lists.php.net to get a copy of this message
> On Oct 30, 2014, at 3:28 PM, Andrea Faulds <ajf@ajf.me> wrote: > > >> On 30 Oct 2014, at 19:51, Will Fitch <willfitch@fastmail.fm> wrote: >> >> My only concern at this point is the default value of the hash. If we were to use spl >> _object_hash, we could be setting a precedence that a hash must be unique to each object. > > In addition to what Stas says above, well, not all objects work like that. What if I want > objects to hash by value, not by identity? Don’t force the identity model. I’m not suggesting we force anything. The tone of the conversation earlier referred to using spl_object_hash as a default. If we don’t do this, that’s totally fine. We don’t have an “__equals” equivalent to Java’s equals(). While I understand the intent of this RFC is not to address that, perhaps it should be considered in the future. > -- > Andrea Faulds > http://ajf.me/ > > > >

« previous php.internals (#78496) next »