Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87578 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39312 invoked from network); 3 Aug 2015 13:35:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Aug 2015 13:35:44 -0000 Authentication-Results: pb1.pair.com header.from=lisachenko.it@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=lisachenko.it@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: lisachenko.it@gmail.com X-Host-Fingerprint: 209.85.215.48 mail-la0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:35253] helo=mail-la0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/B4-13081-F2E6FB55 for ; Mon, 03 Aug 2015 09:35:43 -0400 Received: by labsr2 with SMTP id sr2so11556618lab.2 for ; Mon, 03 Aug 2015 06:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=L4xHw//pMINRn8MMdLde6hQXoW04xc8bDmiBhOfMIBA=; b=A3yh/EN255LCSknDsbpbsanSCAUlrIsdWTlxRUOL3z7VW2+f8TDdyM/X/g0KdyhiPe bHvborpiaAea2+LwhIMgh0QZlck959UtLd0TyVD4ZwEC65Pn+EfdfGJJgSxGLwegEYu0 Ez1NIuCOnNzG6An4ShjvQ6g9i9uLwCi6H+ZwjoaBVp3PbxH/oXS/nbMoG1bqxmHJ3hI6 zj226+IXCFI+IRcnF2CDMTKX+TqX28DrypiEt+9/9zeSVJZarpT7J21WXp4s4jK0B/VV rR0PTLtYb34k6Kz4PE2CrqmQZ8okbiVZOtDudRL1EYpdDOZzTowTDJqxbkjgKctxolEv WqaQ== MIME-Version: 1.0 X-Received: by 10.112.169.69 with SMTP id ac5mr16955709lbc.65.1438608940196; Mon, 03 Aug 2015 06:35:40 -0700 (PDT) Received: by 10.112.72.169 with HTTP; Mon, 3 Aug 2015 06:35:39 -0700 (PDT) In-Reply-To: References: <024101d0cbaa$f864aa50$e92dfef0$@belski.net> <55BDBE25.5050104@gmail.com> <55BE5B89.5080103@gmail.com> Date: Mon, 3 Aug 2015 16:35:39 +0300 Message-ID: To: Etienne Kneuss Cc: Nicolas Grekas , Rowan Collins , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c37f46d9ea4b051c683e63 Subject: Re: [PHP-DEV] Exposing object handles to userland From: lisachenko.it@gmail.com (Alexander Lisachenko) --001a11c37f46d9ea4b051c683e63 Content-Type: text/plain; charset=UTF-8 2015-08-03 16:10 GMT+03:00 Etienne Kneuss : > 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. Probable, there is no actual need for that (to have a unique identifier for each object). Reasons are following: unique identifier is not reliable (depends on the object creation sequence, can be reused later), not predictable (it's not possible to say that one object is the same with another one, which was present in a previous request). Only the case I can see is to store multiple objects in the one list for several reasons (e.g. mediators, etc). But it isn't a task for the core to generate a unique identifer for each object, it's a task for developer to implement this, otherwise it's still unclear, how to compare different objects (for example, during comparison of unserialized objects and an existing one, which can have a different internal object ID). Implementation of Hashable interface can give an answer to that: two objects can be considered equal if they have a same hash code, for example, sha1(json_encode(get_object_vars($this))); --001a11c37f46d9ea4b051c683e63--