On Thu, Jan 26, 2017 at 1:56 PM, Rasmus Schultz <ras...@mindplay.dk> wrote:
> Besides, I mean, I'm sure this has occurred to everyone, right?
>
> https://gist.github.com/mindplay-dk/4ef61fd5c0a35e5aa8fc699febb86487
>
> I personally find that this new syntax you're proposing requires a lot of
> parsing.
>
> I mean, whenever you see substr() or array_map() etc. you're intuitively
> expecting the first argument to be the first argument, right? Now you have
> to backtrack through other lines and figure out the context, or try to spot
> the $$ and count arguments to figure out which is which.

I didn't follow this. Here is the example from your gist written with
either Sara's or my proposal:

    $output = $input
        |> array_filter($$, function($n) { return $n % 2 == 0; })
        |> array_map(function($n) { return $n ** 2; }, $$)
        |> array_reduce($$, function($x, $y) { return $x + $y; })
    ;

Maybe you can explain it a bit more with this code?

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

Reply via email to