Re: [RFC] First-class callable syntax
| From: | Luis Henrique | Date: | Thu, 20 May 2021 16:22:22 +0000 |
| Subject: | Re: [RFC] First-class callable syntax | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-114538@lists.php.net to get a copy of this message | ||
On 20/05/2021 12:55, Guilliam Xavier wrote:
On Thu, May 20, 2021 at 5:12 PM Nikita Popov <nikita.ppv@gmail.com> wrote:I am much more into advanced features of PFA, but is this case why not just use the & operator for "function reference" like C/C++? It is well known and solves the ambiguity with method/function call. $fn = &$this->myFunc; $fn = &myFunc; $fn = &Foo::myFunc;On Thu, May 20, 2021 at 4:16 PM Ondřej Mirtes <ondrej@mirtes.cz> wrote:Hi, several other syntaxes have been proposed to consideration in the PFA thread, and I wouldn't want to start new bikeshedding here; is there a place that would be more appropriate to gather the possibilities (like a kind of updatable list)? Thanks,Hi, I’m confused by the syntax, when I read it, I think to myself “I know this, this is just a method call… oh wait, it’s actually a callable”. It really makes my head hurt.Yes, I can see how that could be confusing. The current syntax is chosen to be a subset of the partial function application proposal. However, I would also be happy with some other syntax that makes it clearer that this is acquiring a callable and not performing a call.