> And then there's the extra typing and visual space taken up, which is not
> something to dismiss entirely.  Also, as someone else mentioned this syntax
> *seems* like it would support nesting. Compare the following:
>
> $x = function($a) => function($b) => function($c) => $a * $b * $c;
> $y = fn($a) => fn($b) => fn($c) => $a * $b * $c;
> $z = |$a| => |$b| => |$c| => $a * $b * $c;
>
> print $x(1)(2)(3); // prints 6
>
> Which of these is more readable?  Id' argue it's not $x.

In a past version the RFC included an example of chaining. The current
version doesn't show an example, but does say it is possible. To be
clear:

    $x = fn($a) => fn($b) => fn($c) => $a * $b * $c;

Is supported in the current implementation. It would similarly be
supported in the `|params| => expr` notation.

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

Reply via email to