Re: [PHP-DEV] [RFC] First-class callable syntax

2021-06-29 Thread Olle Härstedt
2021-05-20 14:48 GMT+02:00, Nikita Popov : > Hi internals, > > I'd like to present an RFC for a first-class callable syntax, which is > intended as a simpler alternative to the partial function application (PFA) > proposal: > > https://wiki.php.net/rfc/first_class_callable_syntax > > See the Ration

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-25 Thread Guilliam Xavier
On Fri, May 21, 2021 at 10:08 AM Rowan Tommins wrote: > > Everyone: please let's keep this thread for talking about first-class > callables, and focus on the semantics not just the syntax - are there > edge cases we need to consider, downsides to the proposed > implementation, etc? > Well the se

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-25 Thread Guilliam Xavier
On Fri, May 21, 2021 at 11:09 AM Andreas Leathley wrote: > [...] > > About the bikeshedding: Using "..." as a symbol does make sense to me, > as variadic unpacking/variadic arguments have a similar connotation > (referring to an unknown/arbitrary amount of elements). * was also > suggested (as in

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-25 Thread Nicolas Grekas
Le ven. 21 mai 2021 à 16:31, Larry Garfield a écrit : > On Fri, May 21, 2021, at 2:52 AM, Nicolas Grekas wrote: > > Sorry for self-reply, this needs some clarifications :) > > > > Le ven. 21 mai 2021 à 09:17, Nicolas Grekas < > nicolas.grekas+...@gmail.com> > > a écrit : > > > > >> There's been a

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-21 Thread Larry Garfield
On Fri, May 21, 2021, at 2:52 AM, Nicolas Grekas wrote: > Sorry for self-reply, this needs some clarifications :) > > Le ven. 21 mai 2021 à 09:17, Nicolas Grekas > a écrit : > >> There's been a lot of rapid iteration, experimentation, and rejection. > >> The most recent alternatives are this on

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-21 Thread Andreas Leathley
On 20.05.21 21:35, Larry Garfield wrote: There's been a lot of rapid iteration, experimentation, and rejection. The most recent alternatives are this one from Levi: https://gist.github.com/morrisonlevi/f7cf949c02f5b9653048e9c52dd3cbfd And this one from me: https://gist.github.com/Crell/ead27e73

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-21 Thread Rowan Tommins
On 20/05/2021 23:58, David Gebler wrote: I think this is very sensible, I can only really say I'd rather have Nikita's proposal land in 8.1 and PFAs in 9.0 done right than have PFAs in 8.1 but in a way which is confusing, ambiguous or problematic for users, or not covering reasonable expected use

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-21 Thread Nicolas Grekas
Sorry for self-reply, this needs some clarifications :) Le ven. 21 mai 2021 à 09:17, Nicolas Grekas a écrit : > Thank you all for your efforts, I think we're almost there and that PFA > would be a really great and useful addition to the language. > > Le jeu. 20 mai 2021 à 21:38, Larry Garfield

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-21 Thread Nicolas Grekas
Thank you all for your efforts, I think we're almost there and that PFA would be a really great and useful addition to the language. Le jeu. 20 mai 2021 à 21:38, Larry Garfield a écrit : > On Thu, May 20, 2021, at 10:55 AM, Guilliam Xavier wrote: > > On Thu, May 20, 2021 at 5:12 PM Nikita Popov

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread David Gebler
On Thu, May 20, 2021 at 8:38 PM Larry Garfield wrote: > > There's been a lot of rapid iteration, experimentation, and rejection. > The most recent alternatives are this one from Levi: > > https://gist.github.com/morrisonlevi/f7cf949c02f5b9653048e9c52dd3cbfd > > And this one from me: > > https://g

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Rowan Tommins
On 20/05/2021 21:54, Kamil Tekiela wrote: This would be less confusing than the (...) syntax IMHO. Of course this still has the same ambiguity as Rowan points out. Is ::$objA->methA a property or a method? We could solve this problem by specifying the syntax to always refer to methods/functions.

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Kamil Tekiela
Hi Nikita, I would like to just express my feelings. It's a definite YES from me for first-class callables. We need something to replace [$this, 'privateMethod']. I just don't like the proposed syntax. The triple period '...' has a meaning already and reusing the same syntax isn't nice. I haven't

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Rowan Tommins
On 20/05/2021 19:16, Alexandru Pătrănescu wrote: Also, considering the resolution between property and method (or between constants and static methods) , it's clear that we need a syntax that looks like the usual invocation:(...), or (?), (...?), ($), ($$), (...$) etc. I'd like to expand on th

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Larry Garfield
On Thu, May 20, 2021, at 10:55 AM, Guilliam Xavier wrote: > On Thu, May 20, 2021 at 5:12 PM Nikita Popov wrote: > > > On Thu, May 20, 2021 at 4:16 PM Ondřej Mirtes wrote: > > > > > Hi, I’m confused by the syntax, when I read it, I think to myself “I know > > > this, this is just a method call… o

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Aleksander Machniak
On 20.05.2021 19:05, Nikita Popov wrote: >> $fn = &Foo::myFunc; >> > Unfortunately, this syntax is trivially ambiguous. "$fn = &$this->myFunc" > is currently already interpreted as a reference assignment of the property > $this->myFunc. could that be just fn(sth)? I mean without the => part. $fn

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Alexandru Pătrănescu
On Thu, May 20, 2021, 15:48 Nikita Popov wrote: > Hi internals, > > I'd like to present an RFC for a first-class callable syntax, which is > intended as a simpler alternative to the partial function application (PFA) > proposal: > > https://wiki.php.net/rfc/first_class_callable_syntax > > This lo

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Dan Ackroyd
Ondřej Mirtes wrote: > Hi, I’m confused by the syntax, when I read it,... That is true of almost any new syntax. Some of us are still getting used to seeing \ in front of function calls. It doesn't mean that the syntax choice is a bad one, just that it's something new. For me, the main questions

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Matthew Brown
On Thu, 20 May 2021 at 10:17, Ondřej Mirtes wrote: > 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. > I agree with the first point — slightly confusing initially, bu

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Nikita Popov
On Thu, May 20, 2021 at 6:22 PM Luis Henrique wrote: > On 20/05/2021 12:55, Guilliam Xavier wrote: > > On Thu, May 20, 2021 at 5:12 PM Nikita Popov > wrote: > > > >> On Thu, May 20, 2021 at 4:16 PM Ondřej Mirtes wrote: > >> > >>> Hi, I’m confused by the syntax, when I read it, I think to myself

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Luis Henrique
On 20/05/2021 12:55, Guilliam Xavier wrote: On Thu, May 20, 2021 at 5:12 PM Nikita Popov wrote: On Thu, May 20, 2021 at 4:16 PM Ondřej Mirtes wrote: 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”

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Guilliam Xavier
On Thu, May 20, 2021 at 5:12 PM Nikita Popov wrote: > On Thu, May 20, 2021 at 4:16 PM Ondřej Mirtes wrote: > > > 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. >

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Nikita Popov
On Thu, May 20, 2021 at 4:16 PM Ondřej Mirtes wrote: > 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 synta

Re: [PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Ondřej Mirtes
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. Also, static analysers already have to reason about current code, so PHPStan (and Psalm probably too) already supports refer

[PHP-DEV] [RFC] First-class callable syntax

2021-05-20 Thread Nikita Popov
Hi internals, I'd like to present an RFC for a first-class callable syntax, which is intended as a simpler alternative to the partial function application (PFA) proposal: https://wiki.php.net/rfc/first_class_callable_syntax See the Rationale section for details on how this relates to PFA. Over t