Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77620 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56730 invoked from network); 25 Sep 2014 10:22:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Sep 2014 10:22:54 -0000 Authentication-Results: pb1.pair.com header.from=florian@margaine.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=florian@margaine.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain margaine.com from 209.85.223.170 cause and error) X-PHP-List-Original-Sender: florian@margaine.com X-Host-Fingerprint: 209.85.223.170 mail-ie0-f170.google.com Received: from [209.85.223.170] ([209.85.223.170:36110] helo=mail-ie0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 88/A1-45824-DFCE3245 for ; Thu, 25 Sep 2014 06:22:54 -0400 Received: by mail-ie0-f170.google.com with SMTP id x19so10443033ier.29 for ; Thu, 25 Sep 2014 03:22:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=LAZ3wMOzKMoX9u9VWSJ8tSvW0YKFHgD/7hMHqlX7VhQ=; b=T+8U2ien+m3fSHpKxW7xZ7/vCu8jz04ADbTKySfoITAbbe2g99bK5F+K6wy9gHJTqu R41Rn6TlOX1Ut8h77hA30k47566CpI2wJVe0+VmUpOLnnQlRl78/sjC2JkkStwRWBRiV gS6o2wEFv66GyZKlIO0t2zSSTs0Ys238S03ViXePqpALLMbqhqietUW4Gc5FtOrMs54M RN0EXKPeuj2WxdPfJC1qDgd57JKY7++3fBSOhAOTnNEsyuijYdiU7Keq+9vAfKCKGUUa +RKzSYd1nrkTQMqaQBYdm+0QL5V5mo/YayvASXnzzcG5vaqT/jXg4EW6PZF07PyOTQHR fkfA== X-Gm-Message-State: ALoCoQlg3JjRHyzpopBbaUnetebg8n/CP0pa68UCvtEx2ZKuxeeVW99pfGeTw3eVjf9XS1IDr3pP X-Received: by 10.51.17.2 with SMTP id ga2mr3298121igd.12.1411640570096; Thu, 25 Sep 2014 03:22:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.5.194 with HTTP; Thu, 25 Sep 2014 03:22:30 -0700 (PDT) X-Originating-IP: [89.92.205.106] In-Reply-To: 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> Date: Thu, 25 Sep 2014 12:22:30 +0200 Message-ID: To: Pierre Joye Cc: Andrea Faulds , Stas Malyshev , Michael Wallner , PHP internals Content-Type: multipart/alternative; boundary=001a113491e4bb480b0503e12eeb Subject: Re: [PHP-DEV] Invokation on __toString() for object used as array key From: florian@margaine.com (Florian Margaine) --001a113491e4bb480b0503e12eeb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 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. It would also give better tools to deal with situations such as: $test =3D 1; $test2 &=3D $test; I'm willing to write an RFC if necessary to include it. Thoughts? On Thu, Sep 25, 2014 at 11:50 AM, Pierre Joye wrote: > On Wed, Sep 24, 2014 at 9:44 PM, Andrea Faulds wrote: > > > > On 24 Sep 2014, at 20:39, Stas Malyshev wrote: > > > >>> I also wonder why we still need them. Doing what has been done with g= mp > >>> for all resources would be a good move for 7. > >> > >> In general, I think we do not - IIRC everything resources do objects c= an > >> do better now, and the problems that prevented one from using objects > >> instead of resources are long gone. > >> > >> However, is_resource() checks and lots of third-party extensions using > >> resources may be a bit of a problem for eliminating them. > > > > I already figured out how to solve the `is_resource()` issue. Create an > almost-useless, uninstantiatable class called Resource which any new > resource-replacing classes inherit from. Then, make `is_resource()` check > whether something is an instance of that class. > > > > Of course, 3rd-party extensions are still a problem, but this should > mostly fix it. Of course, gettype() is still going to return =E2=80=9Cobj= ect=E2=80=9D not > =E2=80=9Cresource=E2=80=9D, but I suspect people are more likely to use i= s_resource(). > > Is it really necessary? I could imagine a transition with 5.7 for > that, similar to gmp. > > Cheers, > -- > Pierre > > @pierrejoye | http://www.libgd.org > --=20 Regards, *Florian Margaine* --001a113491e4bb480b0503e12eeb--