Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Larry Garfield
On Mon, Jan 23, 2023, at 3:52 PM, Dan Ackroyd wrote: > On Mon, 23 Jan 2023 at 20:51, Larry Garfield wrote: >> >> On Mon, Jan 23, 2023, at 12:32 PM, Dan Ackroyd wrote: >> >> > >> > $fnConstructor = Closure::fromClassConstructor(Zoq::class); >> > // signature of $fnConstructor is the same as

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callablesyntax on non-static methods, statically

2023-01-23 Thread Christoph M. Becker
On 23.01.2023 at 19:22, Robert Landers wrote: > Speaking of partial application, it'd be amazing if it were available > with the current closure syntax: > > $func = fn($x, $y, $z) => echo $x + $y + $z; > $plus1 = $func(..., 1); > $plus2n1 = $func(2, 1, ...); > > $a = $plus1(1, 2); > $b =

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Dan Ackroyd
On Mon, 23 Jan 2023 at 20:51, Larry Garfield wrote: > > On Mon, Jan 23, 2023, at 12:32 PM, Dan Ackroyd wrote: > > > > > $fnConstructor = Closure::fromClassConstructor(Zoq::class); > > // signature of $fnConstructor is the same as `function(Fot $fot): Zoq` > > > > Or for individual methods: > > >

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Larry Garfield
On Mon, Jan 23, 2023, at 12:32 PM, Dan Ackroyd wrote: > On Sun, 22 Jan 2023 at 17:45, Ollie Read wrote: >> >> Hello all, > > Hi Ollie, > >> I've created a feature request issue on GitHub (here: >> https://github.com/php/php-src/issues/10414), but I have been advised that >> it's best to post

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Dan Ackroyd
On Sun, 22 Jan 2023 at 17:45, Ollie Read wrote: > > Hello all, Hi Ollie, > I've created a feature request issue on GitHub (here: > https://github.com/php/php-src/issues/10414), but I have been advised that > it's best to post here. > ... > I think we could delay the error until the closure

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Robert Landers
On Mon, Jan 23, 2023 at 6:31 PM Larry Garfield wrote: > > On Mon, Jan 23, 2023, at 10:53 AM, Ollie Read wrote: > > There's definitely similarity, but I would say it sits somewhere > > between the two. Rather than reference a partial method call, or create > > a closure for a method, you're

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Larry Garfield
On Mon, Jan 23, 2023, at 10:53 AM, Ollie Read wrote: > There's definitely similarity, but I would say it sits somewhere > between the two. Rather than reference a partial method call, or create > a closure for a method, you're delaying a method call. Or rather, > referencing a method. We have

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Larry Garfield
On Mon, Jan 23, 2023, at 10:08 AM, Robert Landers wrote: > In my mind, Test::Func(...) should be treated the same as ['Test', > 'Func'] or 'Test::Func' until it is called and if some fancy framework > wants to do something special with the closure, it can do so. FWIW, I > didn't even know this

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Larry Garfield
On Mon, Jan 23, 2023, at 9:39 AM, Ollie Read wrote: > You are absolutely correct. I guess the solution would be to handle it > differently in this case. > > Creating a closure from a static method would be fine, as it creates a > static closure, but when attempting to create a static closure

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Ollie Read
There's definitely similarity, but I would say it sits somewhere between the two. Rather than reference a partial method call, or create a closure for a method, you're delaying a method call. Or rather, referencing a method. We have the ::class pseudo property, so I see this like an equivalent,

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Deleu
On Mon, Jan 23, 2023, 1:16 PM Ollie Read wrote: > Oh, I didn't mean to suggest that it automatically binds. > > My second suggestion for how to achieve this does require some sort of > automation. If you create a closure from Str::someMethod($arg1, $arg2) > where someMethod isn't static, it

Re: [PHP-DEV] [RFC] Pass Scope to Magic Accessors

2023-01-23 Thread Nicolas Grekas
> On 1/19/23 18:43, Ilija Tovilo wrote: > > You're right, we'll try to improve the wording and provide a handful of > > examples. Essentially, $callingScope should contain the class name of > > the calling scope, so the place where the magic method was called. When > > the calling scope is not a

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Ollie Read
Oh, I didn't mean to suggest that it automatically binds. My second suggestion for how to achieve this does require some sort of automation. If you create a closure from Str::someMethod($arg1, $arg2) where someMethod isn't static, it should create a closure with the signature fn(Str $object,

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Robert Landers
On Mon, Jan 23, 2023 at 4:39 PM Ollie Read wrote: > > You are absolutely correct. I guess the solution would be to handle it > differently in this case. > > Creating a closure from a static method would be fine, as it creates a static > closure, but when attempting to create a static closure

Re: [PHP-DEV] Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically

2023-01-23 Thread Ollie Read
You are absolutely correct. I guess the solution would be to handle it differently in this case. Creating a closure from a static method would be fine, as it creates a static closure, but when attempting to create a static closure from a non-static method, it would instead return a closure

Re: [PHP-DEV] [RFC] Path to Saner Increment/Decrement operators

2023-01-23 Thread G. P. B.
On Fri, 20 Jan 2023 at 19:44, Jordan LeDoux wrote: > I don't see a section in the RFC about JIT or anything related to OpCache, > but I know from experience with the Operator Overloads RFC that there are > several architecture specific assembly optimizations for ++ and --. Have > these been

Re: [PHP-DEV] [RFC] Path to Saner Increment/Decrement operators

2023-01-23 Thread G. P. B.
On Fri, 20 Jan 2023 at 18:28, Mark Baker wrote: > The documentation page consistently uses the word Increment and > Decrement, not Add 1 and Subtract 1. > > Developers who read the documentation should be aware of the Perl > convention when dealing with alphabetic strings, and should expect that