Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34151 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30896 invoked by uid 1010); 20 Dec 2007 18:02:30 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 30880 invoked from network); 20 Dec 2007 18:02:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Dec 2007 18:02:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=sean@caedmon.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sean@caedmon.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain caedmon.net from 64.15.79.181 cause and error) X-PHP-List-Original-Sender: sean@caedmon.net X-Host-Fingerprint: 64.15.79.181 iconoclast.caedmon.net Linux 2.5 (sometimes 2.4) (4) Received: from [64.15.79.181] ([64.15.79.181:35001] helo=iconoclast.caedmon.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FA/B1-19413-D2EAA674 for ; Thu, 20 Dec 2007 13:02:25 -0500 Received: from localhost (localhost [127.0.0.1]) by iconoclast.caedmon.net (Postfix) with ESMTP id 4726BE802E; Thu, 20 Dec 2007 13:02:11 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at iconoclast.caedmon.net Received: from iconoclast.caedmon.net ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2DHhqzKku0CO; Thu, 20 Dec 2007 13:01:59 -0500 (EST) Received: from [10.8.0.2] (sarcasm.vpn [10.8.0.2]) by iconoclast.caedmon.net (Postfix) with ESMTP id 43D24E802D; Thu, 20 Dec 2007 13:01:59 -0500 (EST) Cc: Alexey Zakhlestin , troels knak-nielsen , internals@lists.php.net Message-ID: <12F80350-F0D2-45D2-9762-B6F361D3704E@caedmon.net> To: Stanislav Malyshev In-Reply-To: <476AA387.3070002@zend.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v915) Date: Thu, 20 Dec 2007 13:02:01 -0500 References: <98b8086f0712150818n40056cedyf0aae7a5a08a27b7@mail.gmail.com> <200712172130.08216.larry@garfieldtech.com> <4FADC266-873E-4FD2-BEC8-28EA9D833297@procata.com> <200712172341.54372.larry@garfieldtech.com> <98b8086f0712191345h7fe11a7kc5d34b0369754c8f@mail.gmail.com> <47699960.1090101@zend.com> <98b8086f0712191528n2fd348d0oe3da9eed20d87194@mail.gmail.com> <4769ACF5.7000701@zend.com> <476AA387.3070002@zend.com> X-Mailer: Apple Mail (2.915) Subject: Re: [PHP-DEV] Re: PATCH: anonymous functions in PHP From: sean@caedmon.net (Sean Coates) >> array_filter($my_data, function($test){ return 3 === ($test % 4) }); > What's wrong with regular functions? At risk of wading into yet circular another discussion on internals@, I was part of the original thread on this subject, and I agree with Stas here: unless they're real closure, they're pretty useless. Apart from saving a few keystrokes, the above could easily be changed to the following, which is much more clear, DOES compile at compile- time, and works without adding a new construct that looks like a closure, but is not indeed one: function aiusdyasdjkhasdIMASHEDTHEKEYBOARD($test){ return 3 === ($test % 4) } array_filter($my_data, 'aiusdyasdjkhasdIMASHEDTHEKEYBOARD'); // I copy & pasted the callback name; aren't modern computers fascinating?! (-: S