Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87496 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93048 invoked from network); 2 Aug 2015 09:06:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2015 09:06:01 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.173 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.173 mail-pd0-f173.google.com Received: from [209.85.192.173] ([209.85.192.173:35483] helo=mail-pd0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/B0-22986-87DDDB55 for ; Sun, 02 Aug 2015 05:06:01 -0400 Received: by pdrg1 with SMTP id g1so61568851pdr.2 for ; Sun, 02 Aug 2015 02:05:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=CpA8hIPpAGXnju7wUDGPOBmBykH4ND819r+zpSVoFfk=; b=xk4O8zpplhExuNdRpQUriPn/bV987UnUowGHPPlRLIMLAns5i7v0XGz05WCyz0nQyF SYXpwhL9B41yRhKu8EhPkTGHHku9rgMTSOINkhiPrffmnPCCyZgl5dsYoNdlZm30mgrb fs8WgiPBeNX28hxzyW1AONq3fZKpn1jYjqH02dgw1kAvQMC0IYBSSa4A+4PybH4iEHMa lVsJoXw8o+SZceqI/RdpPhZJkpoRa+ghqi/g1gYOo/dpf0AsduZWTzGFcQlE6+kcTXj6 73jqR+891fSSWh6hJvGLKM+jL2DNrKhUimXETWz7iZR821zIZQ/uAVEI7i5BdPcYzuGA JRNQ== X-Received: by 10.70.88.2 with SMTP id bc2mr24958964pdb.153.1438506356977; Sun, 02 Aug 2015 02:05:56 -0700 (PDT) Received: from Stas-Air.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by smtp.gmail.com with ESMTPSA id of5sm13779263pdb.52.2015.08.02.02.05.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Aug 2015 02:05:56 -0700 (PDT) To: Nicolas Grekas References: <55BDC196.1030306@gmail.com> Cc: Nikita Popov , Julien Pauli , PHP Internals X-Enigmail-Draft-Status: N1110 Message-ID: <55BDDD6D.2060802@gmail.com> Date: Sun, 2 Aug 2015 02:05:49 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Exposing object handles to userland From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > This is already part of the public API: var_dump and debug_zval_dump do > expose object IDs to userland. It's just inefficient to get for more Debug functions are not the part of public API. If you rely on anything var_dump is producing for your code to work, you risk your code being broken any time, without warning or any BC consideration. > Even if its internal implementation is totally different from PHP's, > HHVM adds an id to every object, just for this requirement: matching > what PHP exposes to userland. That's HHVM's decision, however the fact that they need to fake IDs is not a good thing. Proper code should not depend on such details of engine implementation. > I'd more than happy to have an spl_object_id() function btw! I wouldn't be very happy, because it is wrong design to base userland PHP code on a detail of an implementation of the engine. That's why there was a hash and not direct ID - so that the code would not depend on implementation detail and anything that produces different hash for different objects would work. The alternative (stuffing the ID into spl_object_hash) is worse however. -- Stas Malyshev smalyshev@gmail.com