Re: Arrow function expressions in PHP
| From: | Pavel Kouřil | Date: | Thu, 01 Oct 2015 07:11:12 +0000 |
| Subject: | Re: Arrow function expressions in PHP | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88596@lists.php.net to get a copy of this message | ||
On Tue, Sep 29, 2015 at 11:55 PM, Levi Morrison <levim@php.net> wrote:
> Reading over the list I don't think people "are torn about" it. There
> are some detractors, sure, but there seem to be more detractors about
> symbol choice (~) and lack of type declarations.
Personally, I feel that without the auto import, the feature would be
totally useless. But yes, more people are not happy with the ~ choice.
> I disagree that
(int $x) => $x * 2 is vastly better than `fn
> (int
> $x) => $x * 2`. It *might* be better but so much better we should
> introduce backtracking into it? In my opinion that is very clear: no.
> Especially because this also makes it harder to write other tools for
> PHP.
The issue I have with the fn() prefix is that it looks "weird" in case
you are chaining multiples. And it looks like a function call, but it
isn't one.
fn($x) => fn($y) => fn($z)
How does hack solve this? Do they have backtracking in their parser?