Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53671 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51638 invoked from network); 29 Jun 2011 17:03:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jun 2011 17:03:33 -0000 Authentication-Results: pb1.pair.com header.from=johncrenshaw@priacta.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=johncrenshaw@priacta.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain priacta.com designates 64.95.72.241 as permitted sender) X-PHP-List-Original-Sender: johncrenshaw@priacta.com X-Host-Fingerprint: 64.95.72.241 mxout.myoutlookonline.com Received: from [64.95.72.241] ([64.95.72.241:63409] helo=mxout.myoutlookonline.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 22/05-25278-3EA5B0E4 for ; Wed, 29 Jun 2011 13:03:32 -0400 Received: from mxout.myoutlookonline.com (localhost [127.0.0.1]) by mxout.myoutlookonline.com (Postfix) with ESMTP id 7703A553684; Wed, 29 Jun 2011 13:03:29 -0400 (EDT) X-Virus-Scanned: by SpamTitan at mail.lan Received: from HUB025.mail.lan (unknown [10.110.2.1]) by mxout.myoutlookonline.com (Postfix) with ESMTP id 0B0E55535D1; Wed, 29 Jun 2011 13:03:29 -0400 (EDT) Received: from MAILR001.mail.lan ([10.110.18.27]) by HUB025.mail.lan ([10.110.17.25]) with mapi; Wed, 29 Jun 2011 13:03:29 -0400 To: Jarrod Nettles , "internals@lists.php.net" CC: "neufeind@php.net" Date: Wed, 29 Jun 2011 13:03:24 -0400 Thread-Topic: [PHP-DEV] Inline Lambda Functions Thread-Index: Acw2WSszuhcJNcipSf2q9ENan3zaQwAIAQcA Message-ID: References: <1ACBA7A9-A78C-4D7C-8B76-F87EDE13381E@squarecrow.com> In-Reply-To: <1ACBA7A9-A78C-4D7C-8B76-F87EDE13381E@squarecrow.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: [PHP-DEV] Inline Lambda Functions From: johncrenshaw@priacta.com (John Crenshaw) > Instead of this..... > > array_filter($source, function($x){ return $x < 5; }); > > Being able to do this..... (or something like it). > > array_filter($source, $x =3D> $x < 5); This really isn't clear. Deciphering the intent of the code requires lookin= g at all the surrounding stuff, because it could mean something totally dif= ferent in an array. In other words, // This would be a lambda array_filter($source, $x =3D> $x < 5); // This would not array($source, $x =3D> $x < 5); // and this would not call_user_func_array('array_filter', array($source, $x =3D> $x < 5)); The fact that the syntax for an expression isn't portable in places where (= so far) every other expression has been, is a serious concern. Additionally, the proposed syntax is unusable for functions with more than = one line, making it similar in badness to if statements without braces. IMO= the current syntax for inline functions is perfectly sufficient, even for = the PLINQ example given earlier, and has massive advantages over this one i= n terms of readability, affordance, flexibility, and language clarity. John Crenshaw Priacta, Inc.