Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79764 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36274 invoked from network); 17 Dec 2014 01:53:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Dec 2014 01:53:44 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.15.15 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.15.15 mout.gmx.net Received: from [212.227.15.15] ([212.227.15.15:49473] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/D1-25720-722E0945 for ; Tue, 16 Dec 2014 20:53:44 -0500 Received: from [192.168.0.101] ([91.67.244.80]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0M3AzH-1XlBTw1gPP-00szMC; Wed, 17 Dec 2014 02:53:39 +0100 Message-ID: <5490E226.3070202@gmx.de> Date: Wed, 17 Dec 2014 02:53:42 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Stanislav Malyshev , Christoph Becker , "guilhermeblanco@gmail.com" , Rowan Collins CC: PHP internals References: <548FEE87.7020602@gmail.com> <549009EE.7040808@fischer.name> <54907683.2070509@gmail.com> <8AB6896C-D5DB-4471-BBD5-60784B2FC1BE@gmail.com> <54907EDE.6020500@gmail.com> <4E4F7392-154C-4282-8D5D-553194D09DCE@gmail.com> <5490DC22.2080605@gmx.de> <5490DD19.2080502@gmail.com> In-Reply-To: <5490DD19.2080502@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:BUzrCJ+IaHgugyNEjWpdAX05K6fxV1bmPkd+1Nkk229cAzVgR6P FHEJDqk9c6doROAwrFVrheJiQnoqboRiMkTyJ53MOP5kFYiCRFYrN6D7FmqkO+gjZh3QAuR oaknKMunMdHsB/7UoDWcC0KwlzNaAUjBE+UQD0ntCQEIiva3JKV31gOS9ugCSrUKqivZzK0 MbcJSWwqvFsnpfELSyr5g== X-UI-Out-Filterresults: notjunk:1; Subject: Re: [PHP-DEV] [RFC][VOTE] Objects as Keys From: cmbecker69@gmx.de (Christoph Becker) Stanislav Malyshev wrote: >> AIUI, this RFC is meant to introduce some sugar only. Wouldn't it be > > I'm not sure what you mean by "some sugar only". It introduces the > capability of using objects in array key context, which was not > available until now. Yes, but it is already possible to call an object's method in array key context, so in combination with an appropriate interface the same can be accomplished. >> possible to have object hashes without __hash(), by introducing a >> respective interface (maybe "Hashable" or "Identifiable") and requiring >> the appropriate classes to implement this interface? > > It's possible and essentially the same, replacing magic method (which is > how things were done in PHP since forever until now) with interface - > which probably would be slower to check, would still require dedicated > method name, probably starting with __, and will essentially do the same. I didn't mean to argue against the RFC, but merely wanted to point out that one could have object hashes without the proposed magic method (albeit in a more contrived way). Frankly, I don't understand Guilherme's claim: | With this enhancement it would now become possible to implement a | proper IdentityMap. It seems to me that is already possible since PHP 5.0.0. I may be missing an important detail, though. BTW: as a userland developer I would not have called the dedicated method __X, because __* is reserved for PHP's internal usage, AIUI. -- Christoph M. Becker