Re: [PHP-DEV] RFC: short and inner classes

2025-03-06 Thread Rob Landers
On Thu, Mar 6, 2025, at 23:31, Tim Düsterhus wrote: > Hi > > On 3/6/25 23:05, Rob Landers wrote: > >> > >> Closure::fromCallable('Outer::Inner::method'); > > > > You end up with: > > > > object(Closure)#1 (1) { > >["function"]=> > >string(20) "Outer::Inner::method" > > } > > Oka

Re: [PHP-DEV] RFC: short and inner classes

2025-03-06 Thread Rob Landers
On Thu, Mar 6, 2025, at 23:20, Ilija Tovilo wrote: > Hi Rob > > On Thu, Mar 6, 2025 at 12:14 AM Rob Landers wrote: > > > > I'd like to introduce my RFC for discussion: > > https://wiki.php.net/rfc/short-and-inner-classes > > Thank you for your proposal. > > I'm very much against the idea of

Re: [PHP-DEV] RFC: short and inner classes

2025-03-06 Thread Ilija Tovilo
Hi Rob On Thu, Mar 6, 2025 at 12:14 AM Rob Landers wrote: > > I'd like to introduce my RFC for discussion: > https://wiki.php.net/rfc/short-and-inner-classes Thank you for your proposal. I'm very much against the idea of introducing yet another slightly shorter form to declare a class. In your

Re: [PHP-DEV] PHP True Async RFC

2025-03-06 Thread Rowan Tommins [IMSoP]
On 06/03/2025 07:49, Edmond Dantes wrote: > Defining new syntax would encourage us to define a minimum top-level > behaviour, such as "inside an async{} block, these things are possible, > and these things are guaranteed to be true" True. This is precisely the main reason not to change the synta

Re: [PHP-DEV] PHP True Async RFC

2025-03-06 Thread Daniil Gentili
> Of course, this is not an elegant solution, as it adds one more rule to the > language, making it more complex. However, from a legacy perspective, it > seems like a minimal scar. > (to All: Please leave your opinion if you are reading this ) > Larry’s approach seems like a horrible idea to m

Re: [PHP-DEV] PHP True Async RFC

2025-03-06 Thread Daniil Gentili
> Of course, this is not an elegant solution, as it adds one more rule to the > language, making it more complex. However, from a legacy perspective, it > seems like a minimal scar. > (to All: Please leave your opinion if you are reading this ) > Larry’s approach seems like a horrible idea to m

Re: [PHP-DEV] RFC: short and inner classes

2025-03-06 Thread Michał Marcin Brzuchalski
Hi Rob, czw., 6 mar 2025 o 00:16 Rob Landers napisał(a): > Hello PHP Internals, > > I'd like to introduce my RFC for discussion: > https://wiki.php.net/rfc/short-and-inner-classes > > This RFC defines a short class syntax as well as the ability to nest > classes inside another class. This introd

Re: [PHP-DEV] PHP True Async RFC

2025-03-06 Thread Edmond Dantes
> In a syntax-and-semantics approach, we only need to describe the things people actually need. There is no doubt that syntax provides the programmer with a clear tool for expressing intent. > In the same way, do we actually need to design what an "async context" looks like to the user? Its imp

Re: [PHP-DEV] RFC: short and inner classes

2025-03-06 Thread Juris Evertovskis
On 2025-03-06 10:04, Tim Düsterhus wrote: - I don't understand the use of `private` properties. Given that the classes cannot have methods, they would be inaccessible, no? I think the RFC was a bit unclear on this. Short classes can have methods. The short syntax just doesn't provide the abil

Re: [PHP-DEV] PHP True Async RFC

2025-03-06 Thread Edmond Dantes
Hello, Daniil. > Essentially, the only thing that’s needed for backwards-compatibility in most cases is an API that can be used to register onWritable, > onReadable callbacks for streams and a way to register delayed (delay) tasks, to completely remove the need to invoke stream_select. Thank you

Re: [PHP-DEV] PHP True Async RFC

2025-03-06 Thread Edmond Dantes
> One key question, if we disallow explicitly creating Fibers inside an async block, > can a Fiber be created outside of it and not block async, or would that also be excluded? Viz, this is illegal: > Creating a `Fiber` outside of an asynchronous block is allowed; this ensures backward compatibi

Re: [PHP-DEV] RFC: short and inner classes

2025-03-06 Thread Tim Düsterhus
Hi On 3/6/25 20:08, Niels Dossche wrote: What I'm less in favor of is the implementation choice to expose the inner class as a property/const and using a fetch mode to grab it. That feels quite weird to me honestly. How did you arrive at this choice? Somewhat relatedly, the RFC does not menti

Re: [PHP-DEV] RFC: short and inner classes

2025-03-06 Thread Rob Landers
On Thu, Mar 6, 2025, at 22:00, Tim Düsterhus wrote: > Hi > > On 3/6/25 20:08, Niels Dossche wrote: > > What I'm less in favor of is the implementation choice to expose the inner > > class as a property/const and using a fetch mode to grab it. > > That feels quite weird to me honestly. How did you

Re: [PHP-DEV] PHP True Async RFC

2025-03-06 Thread Rowan Tommins [IMSoP]
On 06/03/2025 11:31, Edmond Dantes wrote: For example, PHP has functions for working with HTTP. One of them writes the last received headers into a "global" variable, and another function allows retrieving them. This is where a context is needed. OK, let's dig into this case: what is the actu

Re: [PHP-DEV] RFC: short and inner classes

2025-03-06 Thread Tim Düsterhus
Hi On 3/6/25 22:38, Rob Landers wrote: I put a lot of thought into this issue off and on, all day. I've decided to remove short syntax from the RFC and focus on inner classes. Good choice. Don't forget to update the title of the RFC in the Overview page: https://wiki.php.net/rfc Best rega

Re: [PHP-DEV] RFC: short and inner classes

2025-03-06 Thread Tim Düsterhus
Hi On 3/6/25 23:05, Rob Landers wrote: Closure::fromCallable('Outer::Inner::method'); You end up with: object(Closure)#1 (1) { ["function"]=> string(20) "Outer::Inner::method" } Okay, does calling the closure work and correctly call the `method` on the inner class? The questio

Re: [PHP-DEV] PHP True Async RFC

2025-03-06 Thread Larry Garfield
On Thu, Mar 6, 2025, at 2:52 AM, Edmond Dantes wrote: >> One key question, if we disallow explicitly creating Fibers inside an async >> block, >> can a Fiber be created outside of it and not block async, or would that also >> be excluded? Viz, this is illegal: >> > Creating a `Fiber` outside o

Re: [PHP-DEV] RFC: short and inner classes

2025-03-06 Thread Larry Garfield
On Wed, Mar 5, 2025, at 5:11 PM, Rob Landers wrote: > Hello PHP Internals, > > I'd like to introduce my RFC for discussion: > https://wiki.php.net/rfc/short-and-inner-classes I agree with others who have said this should be two RFCs. They stand alone, but can complement each other well. That's