Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34124 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3091 invoked by uid 1010); 20 Dec 2007 09:46:21 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 3076 invoked from network); 20 Dec 2007 09:46:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Dec 2007 09:46:21 -0000 Authentication-Results: pb1.pair.com header.from=troelskn@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=troelskn@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.198.189 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: troelskn@gmail.com X-Host-Fingerprint: 209.85.198.189 rv-out-0910.google.com Received: from [209.85.198.189] ([209.85.198.189:57508] helo=rv-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 25/7B-15872-8E93A674 for ; Thu, 20 Dec 2007 04:46:21 -0500 Received: by rv-out-0910.google.com with SMTP id k15so2913332rvb.23 for ; Thu, 20 Dec 2007 01:46:08 -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:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=OBMlpu9PeIhf4CxhH7lyVdZIUhrLwPi6VKT6vT/CKMo=; b=UvqqgxKJrK5oYNdC9bOhuj4v8nLd71De4agOEC2USnFUcLe8vfF12G/r+t0yUqsFTNapwjWOXJaTWYaFdYHA0efSuIekg7GWo9cBVc9L+bnphzRS5rAdk14E8ibvvY4DgLRwm7VxrmlEkBEQJ3blVI+nHA1qTXsoNBqoicB7ILA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=M2oN12wqRv+jTTXdfxkyJhvFxIpyi2rFG7On3Ob/GzxrhQDyIDUCfdN0idk4A/WMHHp6UAIT1iRiYFHumjZXCIAuq/oaxn26AEsbSS4kxp0jT7eOoPuZCxlKwp/J+vUMsp7fZiXMm3YnNulbF16AGIiwCWx1IotW5xTxruOtXkc= Received: by 10.140.88.11 with SMTP id l11mr2560251rvb.156.1198143968299; Thu, 20 Dec 2007 01:46:08 -0800 (PST) Received: by 10.141.50.16 with HTTP; Thu, 20 Dec 2007 01:46:08 -0800 (PST) Message-ID: <98b8086f0712200146h7a30412eq5ec8845862c3cac0@mail.gmail.com> Date: Thu, 20 Dec 2007 10:46:08 +0100 To: internals@lists.php.net In-Reply-To: <476A33BD.1050508@daylessday.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <98b8086f0712150818n40056cedyf0aae7a5a08a27b7@mail.gmail.com> <200712172341.54372.larry@garfieldtech.com> <98b8086f0712191345h7fe11a7kc5d34b0369754c8f@mail.gmail.com> <47699960.1090101@zend.com> <98b8086f0712191528n2fd348d0oe3da9eed20d87194@mail.gmail.com> <4769ACF5.7000701@zend.com> <476A208D.9020201@daylessday.org> <476A33BD.1050508@daylessday.org> Subject: Re: [PHP-DEV] Re: PATCH: anonymous functions in PHP From: troelskn@gmail.com ("troels knak-nielsen") (Sorry if you get this twice, Antony. I didn't hit 'Reply to all' the first time) On Dec 20, 2007 10:19 AM, Antony Dovgal wrote: > On 20.12.2007 11:18, Alexey Zakhlestin wrote: > > On 12/20/07, Antony Dovgal wrote: > >> On 20.12.2007 09:57, Alexey Zakhlestin 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) }); > >> > >> Oh, my.. > >> This code clearly demonstrates why a syntax like this should not be allowed. Ever. > > > > you prefer cluttering namespace with a lot of oneliners? > > Oh, come on.. Since when do we call it "cluttering"? > Is there some kind of limit on number of functions in a namespace? Yes there is. Or more precise, there is a limited to the number of sanely named functions. > Why limit yourself and "inline" the function instead of putting it > into a nice library of utility functions? > > > currently, people prefer to use explicit cycles instead of > > array_map/array_filter and that looks ugly (hides actual logic behind > > syntax), but at least it is not as slow as create_function. > > Whatever people currently use - it's their choice. > If you think that people would magically switch to the new syntax (if we decide to > add it after all) in a moment, I'm afraid I have to upset you - this will not happen > in the next 10 years because of many reasons, so people would still use the good > old syntax they're used to. I don't care what other people do with their code base. I don't want to impose anything on them. I just want to not get a headache, when reading my own. > So here is what we _actually_ get with this anonymous function syntax: > 1) Yet another way to make the code unreadable and overcomplicated. > 2) Yet another incompatible syntax you cannot use if you need to support older PHP versions > (and you can't check for it in runtime, since this is a compile time thingie). By that standard, we should never change anything in PHP. Ever. I'm not proposing to roll this out with the next minor release. PHP6 is happening soon; It could include this patch. Of course, if we postprone it long enough, we will have to wait for PHP7. > 3) 10 people happy because they got a new toy. I don't know how to respond to that, without being rude, so I won't. -- troels