Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61370 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78047 invoked from network); 17 Jul 2012 17:03:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2012 17:03:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.193 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.193 smtp193.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.193] ([67.192.241.193:60475] helo=smtp193.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/A4-54353-CFA95005 for ; Tue, 17 Jul 2012 13:03:56 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp9.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 27E423C024B; Tue, 17 Jul 2012 13:03:54 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp9.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 25B1F3C04B6; Tue, 17 Jul 2012 13:03:52 -0400 (EDT) Message-ID: <50059AF8.5050805@sugarcrm.com> Date: Tue, 17 Jul 2012 10:03:52 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Pierre Joye CC: Gustavo Lopes , internals , Andrew Faulds References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Pseudo-objects (methods on arrays, strings, etc.) From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > This idea has been proposed many times in the past and it is actually > a very good proposal, for array, string or other types. If we have "$array->foo()", we should also have "class foo extends array" which allows to override foo() in array. This will require some serious changes, which need to be RFCed and reviewed and seen if they can really fit the language properly. Just saying "let's bolt on method calls on top of arrays" is definitely not very good. Having OO Array type may be good, if we will be able to figure out suitable design that will allow the same flexibility and power as regular arrays - though I'm not sure how to do it now. > The only reason why it is not yet implemented is the technical > complexity to do it. We need pseudo objects and the likes, and it is > really not something easy to do, in an efficient enough way. I disagree - I do not think we need pseudo-objects. If the only point of the exercise is to convert a call of array_pop to $array->pop, it's not worth it. It'd just make the language more messy - you wouldn't know what -> means anymore. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227