Re: [Discussion] Callable types via Interfaces
| From: | Levi Morrison via internals | Date: | Fri, 21 Apr 2023 04:25:59 +0000 |
| Subject: | Re: [Discussion] Callable types via Interfaces | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120096@lists.php.net to get a copy of this message | ||
On Thu, Apr 20, 2023 at 9:57 PM Deleu <deleugyn@gmail.com> wrote:
>
>
>
> On Thu, Apr 20, 2023 at 8:23 PM Levi Morrison via internals <internals@lists.php.net>
> wrote:
>>
>> I'm going to stop here. Two big things:
>>
>> 1. I think reducing verbosity can be left for the future. We don't
>> have to solve that right now.
>
>
>
>> What happens if I pass a short-closure?
>>
>> takeTwo(fn ($x, $y) => $x + $y);
>>
>> I would be annoyed if I had to write the type info, but particularly
>> the return type.
>
>
> Sorry for the unhelpful email, but does anybody else see the irony here? It's just too
> funny to not be mentioned 😂😂😂😂
>
> --
> Marco Deleu
Sure, I get that ^_^ But the difference is that there are quite a few
ways we can solve the first verbosity (allowing
fn instead of
callable, allowing type aliases which could also be useful for
unions, etc), and only things that seem hard to solve the second one
(static type inference? delayed type checks?)