Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34145 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14161 invoked by uid 1010); 20 Dec 2007 17:25:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 14121 invoked from network); 20 Dec 2007 17:25:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Dec 2007 17:25:49 -0000 Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.184.227 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 64.233.184.227 wr-out-0506.google.com Linux 2.4/2.6 Received: from [64.233.184.227] ([64.233.184.227:5149] helo=wr-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 22/D1-03142-985AA674 for ; Thu, 20 Dec 2007 12:25:43 -0500 Received: by wr-out-0506.google.com with SMTP id 55so2956973wri.2 for ; Thu, 20 Dec 2007 09:25:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=eWvbgObuk3d0+n+6wRVc724DIPUE5TF1kZw/5NbC39U=; b=ZHYpxk1H6v1opYN+vUVF5uM7rNfh3yuHskXvfmBQdC3tOzi1eI30zMfbvtih+6HnwJRWCBycxaTn0lZ3gkyQyVwT3hVR2ztumRTmaiD6dR/McnHRbdvK2er4XRUO88tlpu+3tzgHKCc14TuwrcalFAArI2cVFlElKLmgV8Ng0w4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=BWNwtt4qzjBYHvwpzq/n8PvZGTldxJOG6FPOUXwlK/XULYfCC2bnI1iwmGvp8F5ptYrKbBqgODAv9C6Pwd5Fo+N0CgogWL3IOw2nOaLmHyUUOVw7cNCDLZy6/vXB5TLZR7pNUrEYLiGuT+YcbYfzIygVNhzv0um2RI7mp7ErK1M= Received: by 10.150.155.1 with SMTP id c1mr94615ybe.15.1198171521861; Thu, 20 Dec 2007 09:25:21 -0800 (PST) Received: by 10.150.52.9 with HTTP; Thu, 20 Dec 2007 09:25:21 -0800 (PST) Message-ID: Date: Thu, 20 Dec 2007 20:25:21 +0300 To: "Stanislav Malyshev" Cc: "troels knak-nielsen" , internals@lists.php.net In-Reply-To: <476AA387.3070002@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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> Subject: Re: [PHP-DEV] Re: PATCH: anonymous functions in PHP From: indeyets@gmail.com ("Alexey Zakhlestin") On 12/20/07, Stanislav Malyshev wrote: > > being able to do the following (and not to worry about runtime > > compilation) is a good reason on it's own: > > > > array_filter($my_data, function($test){ return 3 === ($test % 4) }); > > What's wrong with regular functions? I wrote in in thread, already, but here is the summary: 1) you need to declare them somewhere, which doesn't make much sense if these functions are meant to be used only in such context. Sometimes there are even problem to give meaningful names to such functions 2) inline-function is a good candidate for automatic optimization (in case of array_filter, array_map and similiar the construction can be converted to the loop) 3) as the result of (1) and (2) it can be used for fast "currying" of other functions -- Alexey Zakhlestin http://blog.milkfarmsoft.com/