Re: [VOTE] First-class callable syntax
| From: | Nikita Popov | Date: | Wed, 07 Jul 2021 21:03:50 +0000 |
| Subject: | Re: [VOTE] First-class callable syntax | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-115356@lists.php.net to get a copy of this message | ||
On Wed, Jul 7, 2021 at 10:41 PM Ralph Schindler <ralph@ralphschindler.com>
wrote:
>
>
> >
> > It would theoretically be:
> >
> > $fn = MyController::myAction(...);
> >
> > It currently errors:
> >
> >> Fatal error: Uncaught Error: Non-static method MyController::myAction()
> cannot be called statically
> >
> > I would be okay with allowing this, as long as it's bound before it's
> called.
>
> Could we do this for 8.1? Does something of this scope need an RFC?
>
> I started working up a patch over the weekend, it is 1/2 done (only 7
> failing tests).
>
> I would really like to see this behavior come in with the (...) syntax,
> as I see it as pretty valuable.
>
I'm rather strongly opposed to this. MyController::myAction(...) is not
callable, ergo trying to create a callable from it will fail. As I said
before, performing the callability check at time of construction is a core
part of this proposal, that I am not willing to compromise on.
Regards,
Nikita