Re: Exposing object handles to userland
| From: | Etienne Kneuss | Date: | Mon, 03 Aug 2015 13:10:35 +0000 |
| Subject: | Re: Exposing object handles to userland | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-87577@lists.php.net to get a copy of this message | ||
On Mon, Aug 3, 2015 at 2:26 PM Alexander Lisachenko <lisachenko.it@gmail.com>
wrote:
> Hello, internals!
>
> I like the idea to assign a custom identifier to the object, but why this
> should be only in the core? Java has a method 'hashCode' which can be used
> to return an unique identifier for specific object.
Java's hashcode is not unique,it is not meant to be: two live objects can
have the same hash.
Having a hashCode method that returns 0 for all objects is a valid (albeit
stupid) implementation.
As for PHP, It seems like what people actually want is a unique identifier
for objects (for the lifetime of the request), but they compromise and use
the handle instead as it is available without userland counter.
Best,