Re: [RFC] Using objects as keys
| From: | Stas Malyshev | Date: | Mon, 27 Oct 2014 17:32:34 +0000 |
| Subject: | Re: [RFC] Using objects as keys | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78396@lists.php.net to get a copy of this message | ||
Hi!
> Is the resulting value intended always to return the same object
> independent of what has been done to the object in the mean time?
That's on you to decide. If you have immutable value object, then yes.
If you have mutable value object (which usually isn't a good idea, but
who knows) then no. If it's not a value object, then probably you don't
want __hash on it at all.
> A fixed 'address' for the physical data when used as an array key? If
> that is the case, then __toKey seems more comfortable. To me a hash is
I'm fine with __toKey, if that's what seems better to the majority.