Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77649 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44116 invoked from network); 26 Sep 2014 07:36:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2014 07:36:41 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.115 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.115 smtp115.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.115] ([108.166.43.115:43287] helo=smtp115.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2A/13-27411-98715245 for ; Fri, 26 Sep 2014 03:36:41 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp15.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 42890380332; Fri, 26 Sep 2014 03:36:38 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp15.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 9BB0938010B; Fri, 26 Sep 2014 03:36:37 -0400 (EDT) X-Sender-Id: smalyshev@sugarcrm.com Received: from Stass-MacBook-Pro.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net [108.66.6.48]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA) by 0.0.0.0:465 (trex/5.2.13); Fri, 26 Sep 2014 07:36:38 GMT Message-ID: <54251785.80907@sugarcrm.com> Date: Fri, 26 Sep 2014 00:36:37 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Florian Margaine , Pierre Joye CC: Andrea Faulds , Michael Wallner , PHP internals References: <54213481.8080700@php.net> <54213ECC.5080204@php.net> <54214E57.3080200@php.net> <54220B80.5050208@sugarcrm.com> <54225D5B.3030402@php.net> <54226509.8080405@sugarcrm.com> <54227E98.3050402@php.net> <54231E06.90208@sugarcrm.com> <9E9CD624-B581-417B-9C9D-5202CA84D52D@ajf.me> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Invokation on __toString() for object used as array key From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > Joe Watkins wrote (for fun) a new operator, `addressof`. Code is > here: https://github.com/krakjoe/php-src/compare/addressof > > I think it makes more sense than a new method on all objects. You could Nobody talks about "new method on all objects" (it's also not really possible in PHP). We're talking about new magic method, which allows the developer to control how class is treated when used as hash key. Note it is not always the same as object's identity - you may want two GMP numbers with value of "1" actually refer to the same key in the hash, just like two numbers 1 do. > use it for any kind of value: scalar, resource, object. Building an > array of sockets, for example, would be very easy with such an operator. Building an array of sockets is easy right now. Same with array of any variables. What is not easy is using socket as an index, but why exactly would you want to do that? > It would also give better tools to deal with situations such as: > > $test = 1; > $test2 &= $test; Why it is the situation that must be dealt with? -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/