I am very much in favour of this. I would typically write the example with
an intermediate variable to avoid all the sad nesting.

$files = scandir($arg);
$files = array_filter($files, function ($x) { return $x !== '.' && $x !==
'..'; });
$files = array_map(function ($x) use ($arg) { return $arg . '/' . $x; },
$files);
$files = getFileArg($files);
$ret   = array_merge($ret, $files);


But it's certainly unfortunate that I had to revert from expressions
without state to ordered statements mutating a variable just to avoid
deeply nested parens. Anything that enables more code to be written
declaratively rather than imperatively is a win in my opinion, especially
if it can be implemented as mere syntactic sugar as is the case here.


On Sat, Apr 30, 2016 at 5:58 AM, Sara Golemon <poll...@php.net> wrote:

> This is one of my favorites out of HackLang.  It's pure syntactic
> sugar, but it goes a long way towards improving readability.
> https://wiki.php.net/rfc/pipe-operator
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to