Re: Re: [RFC][Discuss] Arrow Functions
| From: | Yasuo Ohgaki | Date: | Sat, 04 Feb 2017 07:37:07 +0000 |
| Subject: | Re: Re: [RFC][Discuss] Arrow Functions | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98172@lists.php.net to get a copy of this message | ||
On Sat, Feb 4, 2017 at 4:14 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
>
>> fn(params) => expr
>> |params| => expr
>>
>> I look forward to more discussion!
>>
>
> It's unfortunate we cannot have HHVM/Hack syntax now
> https://docs.hhvm.com/hack/lambdas/introduction
>
> but both
> fn(params) => expr
> |params| => expr
> would be good enough for now. I don't see much problem with
> |(int | float) params| => expr
>
One question. Does the syntax allow chains?
function chained_allow_func() {
$f = |$x| => |$y| => $x + $y;
$fn = $f(3);
return $fn(2); // Returns 5
}
It would be great if this is supported.
Thanks.
--
Yasuo Ohgaki
yohgaki@ohgaki.net