> 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 really isn't clear. Deciphering the intent of the code requires looking at 
all the surrounding stuff, because it could mean something totally different in 
an array. In other words,

    // This would be a lambda
    array_filter($source, $x => $x < 5);
    // This would not
    array($source, $x => $x < 5);
    // and this would not
    call_user_func_array('array_filter', array($source, $x => $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 in terms of 
readability, affordance, flexibility, and language clarity.

John Crenshaw
Priacta, Inc.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to