Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53657 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8730 invoked from network); 29 Jun 2011 14:50:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jun 2011 14:50:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=martinscotta@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=martinscotta@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.45 as permitted sender) X-PHP-List-Original-Sender: martinscotta@gmail.com X-Host-Fingerprint: 209.85.210.45 mail-pz0-f45.google.com Received: from [209.85.210.45] ([209.85.210.45:53938] helo=mail-pz0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/41-32143-4AB3B0E4 for ; Wed, 29 Jun 2011 10:50:12 -0400 Received: by pzk30 with SMTP id 30so1165043pzk.18 for ; Wed, 29 Jun 2011 07:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Bk48Svb5JwsXOaJUoWRUFme4gb+2v6k6cvAGk6wApNI=; b=KQWyw9SrUc9Y/jCn2mLynY3KRsaEu7oqkaFaAO4QoOweTKfBlGDN+Lbws8xisqvNZr QFFny8fMcja+4shbCjnDp0rPL3fbYezgJSx2RB/0XVpYcyZkrv6PiRm/qGt/iR4kpk4u RuWsS+c7LjN25lWZ/1TREyF4NQwpJvmj47yD0= MIME-Version: 1.0 Received: by 10.68.4.129 with SMTP id k1mr1122944pbk.72.1309359009106; Wed, 29 Jun 2011 07:50:09 -0700 (PDT) Received: by 10.68.56.74 with HTTP; Wed, 29 Jun 2011 07:50:09 -0700 (PDT) In-Reply-To: <1ACBA7A9-A78C-4D7C-8B76-F87EDE13381E@squarecrow.com> References: <1ACBA7A9-A78C-4D7C-8B76-F87EDE13381E@squarecrow.com> Date: Wed, 29 Jun 2011 11:50:09 -0300 Message-ID: To: Jarrod Nettles Cc: internals@lists.php.net, neufeind@php.net Content-Type: multipart/alternative; boundary=bcaec520e7c19f0a3e04a6dae647 Subject: Re: [PHP-DEV] Inline Lambda Functions From: martinscotta@gmail.com (Martin Scotta) --bcaec520e7c19f0a3e04a6dae647 Content-Type: text/plain; charset=ISO-8859-1 Wed, Jun 29, 2011 at 9:36 AM, Jarrod Nettles wrote: > Hi Stefan, > > The point was not about array filtering or LINQ or any of that. It was > about the plausibility of using a shorthand for closures. > > Instead of this..... > > array_filter($source, function($x){ return $x < 5; }); > > Being able to do this..... (or something like it). > > array_filter($source, $x => $x < 5); > > This would provide a much more friendly way of using callbacks. Lambdas > have great uses, but I feel like they are underutilized in PHP. C#, for > example, has made excellent use of a lambda-friendly syntax like the one > above, and Java is planning something similar (for Java 8, I believe). > > > From: Stefan Neufeind > Date: June 28, 2011 2:20:39 PM CDT > To: internals@lists.php.net > Subject: Re: [PHP-DEV] Inline Lambda Functions > > > On 06/28/2011 03:51 PM, Jarrod Nettles wrote: > > There are two projects that I've been following for awhile now: PLINQ > > and PHPLinq. > > http://plinq.codeplex.com/ > > http://phplinq.codeplex.com/ > > Both of them have made very solid attempts at providing LINQ-like > > functionality to PHP but with both, I've been a little frustrated > > with the implementations, due to the wordy syntax that PHP lambda > > functions require. > > [...] > > Hi, > > well, for your examples: Why not just array_filter() with an appropriate > callback? Should handle it like you describe plinq does it, right? > > > Jarrod I think is a very good idea. Which you think the syntax will be for... * multiples arguments * multiples sentences * no return value closures could be kind of wordy but they are very clear about those. Martin Scotta > Regards, > Stefan > --bcaec520e7c19f0a3e04a6dae647--