Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65952 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60280 invoked from network); 19 Feb 2013 13:56:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2013 13:56:21 -0000 Authentication-Results: pb1.pair.com header.from=lars@strojny.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=lars@strojny.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain strojny.net from 46.4.40.248 cause and error) X-PHP-List-Original-Sender: lars@strojny.net X-Host-Fingerprint: 46.4.40.248 milch.schokokeks.org Received: from [46.4.40.248] ([46.4.40.248:51731] helo=milch.schokokeks.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/28-17768-38483215 for ; Tue, 19 Feb 2013 08:56:21 -0500 Received: from [192.168.1.92] (p5099f5c8.dip0.t-ipconnect.de [::ffff:80.153.245.200]) (AUTH: PLAIN lars@schokokeks.org, TLS: TLSv1/SSLv3,128bits,AES128-SHA) by milch.schokokeks.org with ESMTPSA; Tue, 19 Feb 2013 14:56:16 +0100 id 0000000000000026.0000000051238480.000056B2 Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) In-Reply-To: <3EBB0AF2-A114-4652-806B-C50DD8F9557D@inviqa.com> Date: Tue, 19 Feb 2013 14:56:15 +0100 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <614856A4-40E1-47B0-B520-D73753D59C29@strojny.net> References: <8490FC41-2696-4948-83A1-3931674183B0@gmail.com> <3EBB0AF2-A114-4652-806B-C50DD8F9557D@inviqa.com> To: Marcello Duarte X-Mailer: Apple Mail (2.1499) Subject: Re: [PHP-DEV] [RFC] Short syntax for anonymous functions From: lars@strojny.net (Lars Strojny) Hi Marcello, Am 19.02.2013 um 14:51 schrieb Marcello Duarte : > Thanks for the feedback. I get most people here don't appreciate the = value of the feature. >=20 > I can understand that If you haven't tried to write a tool like = capistrano, rspec, chef, puppet, etc, etc in PHP you probably won't see = much value in implementing such things. >=20 > On 19 Feb 2013, at 13:19, Derick Rethans wrote: >> On Tue, 19 Feb 2013, Marcello Duarte wrote: >>=20 >>> Inspired by Sara, here is another RFC, I finally got around to = draft: >>>=20 >>> https://wiki.php.net/rfc/short-syntax-for-anonymous-function I don=92t like the syntax, but the proposal in general. If you compare = PHPs syntax to various others, it is indeed clumsy. Python: map(lambda v: v * 2, [1, 2, 3]) Ruby: [1, 2, 3].map{|x| x * 2} Scala: List(1, 2, 3).map((x: Int) =3D> x * 2) PHP: array_map(function ($x) {return $x * 2;}, [1, 2, 3]); So even a statically typed language like Scala is shorter and better to = read. A good improvement would be implicit return and getting rid of the = function keyword. array_map(($x): $x * 2;, [1, 2, 3]); But this RFC should come with a patch, otherwise we are discussing = things that aren=92t necessarily easy to implement. cu, Lars=