Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:28556 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75957 invoked by uid 1010); 22 Mar 2007 18:00:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 75942 invoked from network); 22 Mar 2007 18:00:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Mar 2007 18:00:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.114 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.114 unknown Windows 2000 SP4, XP SP1 Received: from [63.205.162.114] ([63.205.162.114:36306] helo=us-ex1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/B7-25094-A44C2064 for ; Thu, 22 Mar 2007 13:00:44 -0500 Received: from [127.0.0.1] ([192.168.16.109]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 22 Mar 2007 11:00:29 -0700 Message-ID: <4602C43A.8060804@zend.com> Date: Thu, 22 Mar 2007 11:00:26 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0b2 (Windows/20070116) MIME-Version: 1.0 To: Sean Coates CC: Stefan Walk , internals@lists.php.net References: <86478A67-DCA2-4000-9EF0-DA4338E8389B@omniti.com> <45FEFDCE.7050100@zend.com> <1174339527.24632.129.camel@blobule> <45FF01FE.6070504@zend.com> <698DE66518E7CA45812BD18E807866CE185525@us-ex1.zend.net> <698DE66518E7CA45812BD18E807866CE18559A@us-ex1.zend.net> <40259.216.230.84.67.1174435351.squirrel@www.l-i-e.com> <877e9a170703220436l267d2648jc99aaaf9cccecfdd@mail.gmail.com> <46028001.7060204@cschneid.com> <4858f9d90703220731g3752d1e8w368f59f30ddb8086@mail.gmail.com> <4602976B.5040909@caedmon.net> In-Reply-To: <4602976B.5040909@caedmon.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 22 Mar 2007 18:00:29.0567 (UTC) FILETIME=[FA2AE0F0:01C76CAB] Subject: Re: [PHP-DEV] PATCH: anonymous functions in PHP From: stas@zend.com (Stanislav Malyshev) > For the record, I do like this syntax, but it COULD be rewritten using > current practices (see below). That's a good point - actually most uses of closures could be with some effort rewritten as classes. The difference would be that in case of closures, closure chooses which parts of context to import, and in case of objects you would need to explicitly supply the parameters. Also, you'd have to explicitly call the object methods, can't just do $foo(). And of course it's not as slick and generic as closure - you'd have to write new class for each case. > class SortByKey implements Callable { > ... > $Sorter(); Well, you can do it now by using call_user_func(), and you also have advantage of using more than one function per class :) So I'm not sure it's necessary. -- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/