Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79783 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7190 invoked from network); 17 Dec 2014 15:42:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Dec 2014 15:42:45 -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:64275] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/31-34025-474A1945 for ; Wed, 17 Dec 2014 10:42:45 -0500 Received: from [192.168.0.101] ([91.67.244.80]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0LmKag-1XSUE02xAw-00Zudl; Wed, 17 Dec 2014 16:42:38 +0100 Message-ID: <5491A46F.6050102@gmx.de> Date: Wed, 17 Dec 2014 16:42:39 +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> <5490E226.3070202@gmx.de> <5490E6F2.4050109@gmail.com> In-Reply-To: <5490E6F2.4050109@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:7+y+UxucYxWcYHn0kX4Auya29W/qqskr8+2oBGw4PEmFVCU6Gqd j57CmBL8VxI9D9In6HSJxTkIlU+Oug4x2a1016jMMmKDCQtiFmikL247WPBLsLSlEDO1OFj k3yVpB5mZOYmeHBdbl5w1fRGj6/KqbY/u3deS4F3M1xRHXk9saDiBo5lGmBYEvx0qv2TUlJ IUQnotCuT5yu376rWDAIw== X-UI-Out-Filterresults: notjunk:1; Subject: Re: [PHP-DEV] [RFC][VOTE] Objects as Keys From: cmbecker69@gmx.de (Christoph Becker) Stanislav Malyshev wrote: >> 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. > > No, it's not possible. It is possible to call object method in an > expression, and then use the result of the expression as an array key. > But to do that you'd have to check that you're dealing with the object > and the call the special method. Sorry for expressing myself imprecisely. Thanks to Rowan this is hopefully clarified now, see . > Looks like you don't understand why PHP has magic methods - since your > argument applies to every one of them. Why have __toString if you can > just call object method? Why have __call if you could just check if > method exists and call a special method if it doesn't? Why have __isset > if you could just call special method on an object and pass it the > property name? Of course, it's "just sugar". All programming languages > are "just sugar" by that definition. I'm neither arguing against having magic methods and other (syntactic) sugar in general, nor against having __hash() or __toKey() in particular. It's perfectly fine for me, if the RFC passes. >> 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). > > You could have *everything* in a more contrived way. PHP 2 was Turing > complete, I am sure. Were we just wasting time these last 15 or so years > because everything was done in PHP since then was already possible, > albeit "in a more contrived way"? Or maybe there's some value in making > the ways significantly less contrived? IMO, that's the whole point of > what we're doing here. I do really appreciate your work, and I enjoy having a more expressive language. I justed wanted to point out Guilherme's apparent misinterpretation of your RFC, see . -- Christoph M. Becker