Wed, Jun 29, 2011 at 9:36 AM, Jarrod Nettles <jar...@squarecrow.com> 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 <neufe...@php.net>
> 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
>

Reply via email to