Re: [PHP-DEV] [RFC] Static class

2024-07-12 Thread Mike Schinkel
> On Jul 11, 2024, at 8:14 PM, Bilge wrote: > > On 25/06/2024 16:17, Derick Rethans wrote: >> we shouldn't be encouraging static classes as >> a bag of static functions, that ought to be just namespaced functions. >> >> cheers, >> Derick >> > Can someone clue me in as to why grouping related f

Re: [PHP-DEV] [RFC] Static class

2024-07-11 Thread Lanre
On Thu, Jul 11, 2024 at 6:16 PM Bilge wrote: > On 25/06/2024 16:17, Derick Rethans wrote: > > we shouldn't be encouraging static classes as a bag of static functions, that > ought to be just namespaced functions. > > cheers, > Derick > > Can someone clue me in as to why grouping related function

Re: [PHP-DEV] [RFC] Static class

2024-07-11 Thread Bilge
On 25/06/2024 16:17, Derick Rethans wrote: we shouldn't be encouraging static classes as a bag of static functions, that ought to be just namespaced functions. cheers, Derick Can someone clue me in as to why grouping related functions in a file with nothing but a namespace is strictly better

Re: [PHP-DEV] [RFC] Static class

2024-07-08 Thread Bilge
On 08/07/2024 15:13, Alexandru Pătrănescu wrote: But I understand that once a class is static, all the chain of inheritance should be made of static classes, going up or down (and I would also think we can add interfaces and traits.). Correct. If interfaces are not included, do we allow implem

Re: [PHP-DEV] [RFC] Static class

2024-07-08 Thread Alexandru Pătrănescu
On Mon, Jul 8, 2024 at 3:22 PM Bilge wrote: > On 08/07/2024 12:48, Alexandru Pătrănescu wrote: > > > If we support inheritance for static classes, we should allow static on > both interface and abstract classes. > > What do you mean by *allow static on [...] interface*? Are you saying you > also

Re: [PHP-DEV] [RFC] Static class

2024-07-08 Thread Bilge
On 08/07/2024 12:48, Alexandru Pătrănescu wrote: On Mon, Jul 8, 2024 at 1:12 PM Stephen Reay wrote: So really the question should be: why do you feel the need to *disallow* a combination that has no technical issues, and works already? If you're going to disallow abstract why n

Re: [PHP-DEV] [RFC] Static class

2024-07-08 Thread Alexandru Pătrănescu
On Mon, Jul 8, 2024 at 1:12 PM Stephen Reay wrote: > > > So really the question should be: why do you feel the need to *disallow* a > combination that has no technical issues, and works already? If you're > going to disallow abstract why not disallow any class inheritance at all? > Because that's

Re: [PHP-DEV] [RFC] Static class

2024-07-08 Thread Stephen Reay
> On 8 Jul 2024, at 14:42, Bilge wrote: > > On 08/07/2024 01:16, Mike Schinkel wrote: >> Congrats on getting it to this point. > Thanks. It's been an adventure :^) > >> I support this in all but the RFC's restriction on `abstract`, as I have >> previously mentioned on the list. > I must have

Re: [PHP-DEV] [RFC] Static class

2024-07-08 Thread Bilge
On 08/07/2024 01:16, Mike Schinkel wrote: Congrats on getting it to this point. Thanks. It's been an adventure :^) I support this in all but the RFC's restriction on `abstract`, as I have previously mentioned on the list. I must have missed a key point here. Let's suppose we're

Re: [PHP-DEV] [RFC] Static class

2024-07-07 Thread Mike Schinkel
> On Jul 7, 2024, at 4:08 PM, Bilge wrote: > > On 24/06/2024 00:10, Bilge wrote: >> Hi Internals! > I am excited to announce the final implementation for Static Class is ready > for review at and includes a > brief summary of the key semantics of the

Re: [PHP-DEV] [RFC] Static class

2024-07-07 Thread Bilge
On 30/06/2024 16:10, Tim Düsterhus wrote: I strongly favor an opinionated RFC where the RFC author did their research and makes it clear why the proposal is the right choice and backs this up by proper arguments. Of course this doesn't mean that the RFC author should not listen to the list disc

Re: [PHP-DEV] [RFC] Static class

2024-06-30 Thread Mike Schinkel
> On Jun 30, 2024, at 11:10 AM, Tim Düsterhus wrote: > I strongly favor an opinionated RFC where the RFC author did their research > and makes it clear why the proposal is the right choice and backs this up by > proper arguments. Of course this doesn't mean that the RFC author should not > list

Re: [PHP-DEV] [RFC] Static class

2024-06-30 Thread Tim Düsterhus
Hi On 6/28/24 21:29, Bilge wrote: I'm already leaning towards "Don't want static classes" Why? It is important to understand what your misgiving are in case there anything we can do to assuage them. I don't see value in being able to explicitly mark a class as `static` for the reasons that

Re: [PHP-DEV] [RFC] Static class

2024-06-30 Thread Tim Düsterhus
Hi On 6/29/24 17:56, Bilge wrote: - Why is it a class-level flag and not an attribute (similar to the `#[Override]` attribute in PHP 8.3) ? I believe Tim already answered this, and I understood his reasoning to be that keywords are used when they modify behaviour in a way that is meaningful

Re: [PHP-DEV] [RFC] Static class

2024-06-29 Thread Bilge
Hi Ayesh, On 24/06/2024 08:53, Ayesh Karunaratne wrote: - Why is it a class-level flag and not an attribute (similar to the `#[Override]` attribute in PHP 8.3) ? I believe Tim already answered this, and I understood his reasoning to be that keywords are used when they modify behaviour in a w

Re: [PHP-DEV] [RFC] Static class

2024-06-28 Thread Benjamin Außenhofer
On Mon, Jun 24, 2024 at 1:15 AM Bilge wrote: > Hi Internals! > > I am pleased to present my first RFC: Static class > . > > This work is based on the previous discussion thread on this list of the > same name, and hopefully captured all the relevant details,

Re: [PHP-DEV] [RFC] Static class

2024-06-28 Thread Bilge
Hi Tim, On 27/06/2024 19:24, Tim Düsterhus wrote: On 6/25/24 05:17, Stephen Reay wrote: and I'd rather have the feature with slightly odd syntax rather than not at all. Absolutely not. PHP is already odd enough as it is. We should not add additional oddness in the interest of pushing a new sc

Re: [PHP-DEV] [RFC] Static class

2024-06-28 Thread Lynn
On Fri, Jun 28, 2024 at 8:04 PM Stephen Reay wrote: > > > On 28 Jun 2024, at 14:05, Lynn wrote: > > > > On Fri, Jun 28, 2024 at 2:48 AM Mike Schinkel wrote: > >> >> and inheritance is not meant for code reuse. >> >> Just because code reuse in inheritance can be problematic it does not >> have t

Re: [PHP-DEV] [RFC] Static class

2024-06-28 Thread Stephen Reay
> On 28 Jun 2024, at 14:05, Lynn wrote: > > > > On Fri, Jun 28, 2024 at 2:48 AM Mike Schinkel > wrote: >> >> and inheritance is not meant for code reuse. >> >> Just because code reuse in inheritance can be problematic it does not have >> to be in all-cases. Mode

Re: [PHP-DEV] [RFC] Static class

2024-06-28 Thread Lanre
On Fri, Jun 28, 2024 at 1:05 AM Lynn wrote: > > > On Fri, Jun 28, 2024 at 2:48 AM Mike Schinkel wrote: > >> >> and inheritance is not meant for code reuse. >> >> Just because code reuse in inheritance can be problematic it does not >> have to be in all-cases. Moderation in all things. I used tha

Re: [PHP-DEV] [RFC] Static class

2024-06-28 Thread Lynn
On Fri, Jun 28, 2024 at 2:48 AM Mike Schinkel wrote: > >> and inheritance is not meant for code reuse. > > Just because code reuse in inheritance can be problematic it does not have > to be in all-cases. Moderation in all things. I used that approach for 10+ > years and never once had any of the

Re: [PHP-DEV] [RFC] Static class

2024-06-27 Thread Mike Schinkel
> On Jun 27, 2024, at 2:11 PM, Tim Düsterhus wrote: > Marking a class as 'static' *does* affect how the class may be used and thus > the static-ness is part of the public API. Therefore it should be a keyword. > Everything else would also be inconsistent with final classes effectively > making

Re: [PHP-DEV] [RFC] Static class

2024-06-27 Thread Lanre
On Thu, Jun 27, 2024 at 1:18 PM Tim Düsterhus wrote: > It should not. See: readonly classes. I also believe that static classes > should be implictly final. Given that no objects of such a class can > exist, they cannot be exchanged by a different class anyways and > inheritance is not meant for

Re: [PHP-DEV] [RFC] Static class

2024-06-27 Thread Tim Düsterhus
Hi On 6/25/24 10:41, Stephen Reay wrote: Like I said, I much prefer the keyword syntax - but I also recognise that others may have different priorities in terms of supporting older language versions, which is why I think that aspect is worth consideration (perhaps a secondary vote, or an info

Re: [PHP-DEV] [RFC] Static class

2024-06-27 Thread Tim Düsterhus
Hi On 6/25/24 05:17, Stephen Reay wrote: and I'd rather have the feature with slightly odd syntax rather than not at all. Absolutely not. PHP is already odd enough as it is. We should not add additional oddness in the interest of pushing a new screw-shaped feature in with a sledgehammer. Any

Re: [PHP-DEV] [RFC] Static class

2024-06-27 Thread Tim Düsterhus
Hi On 6/24/24 09:53, Ayesh Karunaratne wrote: Personally, I think this will be a useful feature. Just like we have `readonly` properties and `readonly` classes, I don't see why we can't have static methods. I also saw in the draft PR that it does not require a lot of changes to the engine to hav

Re: [PHP-DEV] [RFC] Static class

2024-06-27 Thread Mike Schinkel
> > On Jun 27, 2024 at 3:26 AM, mailto:php-li...@koalephant.com)> > wrote: > > > > I think I understand your view: you're not as concerned with consistency if > the alternative is something "better". > > > That yes, but more importantly, that deciding NOT

Re: [PHP-DEV] [RFC] Static class

2024-06-27 Thread Stephen Reay
> On 27 Jun 2024, at 13:11, Mike Schinkel wrote: > > >> On Jun 27, 2024, at 12:09 AM, Stephen Reay > > wrote: >> >> Hi Mike, >> >> To answer your question: I believe `abstract static` should be allowed, >> because the "objection" mis-characterises a particul

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Mike Schinkel
> On Jun 27, 2024, at 12:09 AM, Stephen Reay wrote: > > Hi Mike, > > To answer your question: I believe `abstract static` should be allowed, > because the "objection" mis-characterises a particular aspect of them as an > unintended consequence, when there's evidence to show that's not that ca

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Stephen Reay
> On 27 Jun 2024, at 10:11, Mike Schinkel wrote: > > Hi Stephen, > >> On Jun 26, 2024, at 4:26 AM, Stephen Reay > > wrote: >> >> This is an example of code that works today (and all the way back to 5.0): >> https://3v4l.org/4EKo2 >> >> The class hierarchy em

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Mike Schinkel
Hi Larry, > On Jun 26, 2024, at 2:21 PM, Larry Garfield > wrote: > PHP has no concept of packages at present, and thus no concept of > package-level scope. Not entirely true. PHP has static classes, which are stand-ins for packages for as long as PHP does not

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Mike Schinkel
Hi Stephen, > On Jun 26, 2024, at 4:26 AM, Stephen Reay wrote: > > This is an example of code that works today (and all the way back to 5.0): > https://3v4l.org/4EKo2 > > The class hierarchy embody the type of classes this RFC is about: only static > members, no insta

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Chuck Adams
> On Jun 26, 2024, at 5:49 PM, Derick Rethans wrote: > > There has been some work done on function autoloading too: > https://wiki.php.net/rfc/core-autoloading Fantastic! I still want modules and/or companion objects of course... I wonder whether the autoloading machinery could be bent to

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Lanre
On Wed, Jun 26, 2024 at 5:52 PM Derick Rethans wrote: > On Tue, 25 Jun 2024, Chuck Adams wrote: > > > > On Jun 25, 2024, at 9:17 AM, Derick Rethans wrote: > > > > > > Having read this thread, and the previous one from half a year ago, > > > I will do so too. In short, we shouldn't be encouraging

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Derick Rethans
On Tue, 25 Jun 2024, Chuck Adams wrote: > > On Jun 25, 2024, at 9:17 AM, Derick Rethans wrote: > > > > Having read this thread, and the previous one from half a year ago, > > I will do so too. In short, we shouldn't be encouraging static > > classes as a bag of static functions, that ought to b

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Derick Rethans
On Wed, 26 Jun 2024, Lanre wrote: > That isn't a top post, look again. It was. If people point out you're doing something against this list's guidelines, don't reply with "it wasn't" in a snarky way. cheers, Derick

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Lanre
Also I specifically said "we can declare functions that are local to the current file by not exporting them.", Where did you get "package private" from? On Wed, Jun 26, 2024 at 1:46 PM Larry Garfield wrote: > On Wed, Jun 26, 2024, at 6:05 PM, Lanre wrote: > > In JavaScript/Typescript, we can dec

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Lanre
That isn't a top post, look again.And I am not referring to packages,rather to the ability to define functions that aren't exposed to the users of a library. C doesn't have packages either yet this is possible in it. And marking it as internal is not the same thing at all. I am not going to argue a

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Bilge
On 25/06/2024 16:17, Derick Rethans wrote: we shouldn't be encouraging static classes as a bag of static functions, that ought to be just namespaced functions. I understand this is the prevailing preference of a certain few, including (but not limited to) yourself and Larry. Nevertheless, clas

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Larry Garfield
On Wed, Jun 26, 2024, at 6:05 PM, Lanre wrote: > In JavaScript/Typescript, we can declare functions that are local to > the current file by not exporting them. In C/C++ this is achieved by > simply writing the function in the implementation file as opposed to > the header. However, achieving a s

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Lanre
In JavaScript/Typescript, we can declare functions that are local to the current file by not exporting them. In C/C++ this is achieved by simply writing the function in the implementation file as opposed to the header. However, achieving a similar level of privacy in PHP requires using private stat

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Jordi Boggiano
On 2024-06-24 01:10, Bilge wrote: I am pleased to present my first RFC: Static class . Just one point of feedback: for clarity I think it would be good if it mentions that creating dynamic properties i.e. $this->dynamicProp = 'bar' would also throw at runt

Re: [PHP-DEV] [RFC] Static class

2024-06-26 Thread Stephen Reay
> On 26 Jun 2024, at 12:51, Mike Schinkel wrote: > >> On Jun 24, 2024, at 11:17 PM, Stephen Reay > > wrote: >> >> >> >>> On 25 Jun 2024, at 09:22, Mike Schinkel >> > wrote: >>> On Jun 24, 2024, at 3:53 AM, Ayesh Karunaratne >

Re: [PHP-DEV] [RFC] Static class

2024-06-25 Thread Mike Schinkel
> On Jun 25, 2024, at 4:03 AM, Bilge wrote: > Nevertheless, the allure of early adoption is curious, and made me wonder > whether we could do both, just to support early adoption in a > backwards-compatible manner. And that is probably the best solution I've heard regarding this quandary. It

Re: [PHP-DEV] [RFC] Static class

2024-06-25 Thread Mike Schinkel
> On Jun 24, 2024, at 11:17 PM, Stephen Reay wrote: > > > >> On 25 Jun 2024, at 09:22, Mike Schinkel wrote: >> >>> On Jun 24, 2024, at 3:53 AM, Ayesh Karunaratne >> > wrote: >>> - Why is it a class-level flag and not an attribute (similar to the >>> `#[Override]` attri

Re: [PHP-DEV] [RFC] Static class

2024-06-25 Thread Chuck Adams
> On Jun 25, 2024, at 9:17 AM, Derick Rethans wrote: > > Having read this thread, and the previous one from half a year ago, I > will do so too. In short, we shouldn't be encouraging static classes as > a bag of static functions, that ought to be just namespaced functions. Which brings us back to

Re: [PHP-DEV] [RFC] Static class

2024-06-25 Thread Derick Rethans
On Sun, 23 Jun 2024, Larry Garfield wrote: > On Sun, Jun 23, 2024, at 6:10 PM, Bilge wrote: > > Hi Internals! > > > > I am pleased to present my first RFC: Static class > > . > > > > This work is based on the previous discussion thread on this list of the >

Re: [PHP-DEV] [RFC] Static class

2024-06-25 Thread Stephen Reay
Hi, > On 25 Jun 2024, at 15:03, Bilge wrote: > > Hi guys, > > On 25/06/2024 04:17, Stephen Reay wrote: >>> Given a primary purpose for being able to declare a class `static` is to >>> signal intent, disallowing `abstract static` classes seems at odds with >>> that goal. > What is the intent o

Re: [PHP-DEV] [RFC] Static class

2024-06-25 Thread Bilge
Hi guys, On 25/06/2024 04:17, Stephen Reay wrote: Given a primary purpose for being able to declare a class `static` is to *signal intent*, disallowing `abstract static` classes seems at odds with that goal. What is the /intent/ of `abstract static`? How is such intent different f

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Alexandru Pătrănescu
On Tue, Jun 25, 2024 at 1:00 AM Alex Wells wrote: > > a static class member can never implement an interface's contract > Well, PHP is a weird one here compared to other languages Interfaces can contain contracts for static methods and they are checked just like usual non-static methods. Exampl

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Stephen Reay
> On 25 Jun 2024, at 09:22, Mike Schinkel wrote: > >> On Jun 24, 2024, at 3:53 AM, Ayesh Karunaratne > > wrote: >> - Why is it a class-level flag and not an attribute (similar to the >> `#[Override]` attribute in PHP 8.3) ? > > From my perspective that would create much

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Mike Schinkel
> On Jun 24, 2024, at 3:53 AM, Ayesh Karunaratne wrote: > - Why is it a class-level flag and not an attribute (similar to the > `#[Override]` attribute in PHP 8.3) ? From my perspective that would create much confusion among every PHP developer who has not committed to memory when to use `static

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Alex Wells
On Tue, Jun 25, 2024 at 1:56 AM Bilge wrote: > Hi Alex, > > If you wish to implement data objects, what part of the current proposal > precludes you from doing so? > > None, but they both try to solve the same problem, so it's highly unlikely that data objects would ever be considered if this RF

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Bilge
On 24/06/2024 22:56, Alex Wells wrote: Hey Bilge, I'm not usually a resident of these discussions, but it seems like this RFC is heading into a wrong direction. Let me explain: as it currently stands, static properties and methods live separately from instance properties and methods. That mea

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Alex Wells
Hey Bilge, I'm not usually a resident of these discussions, but it seems like this RFC is heading into a wrong direction. Let me explain: as it currently stands, static properties and methods live separately from instance properties and methods. That means a couple of limitations, namely: a static

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Robert Landers
On Mon, Jun 24, 2024 at 10:22 PM Bilge wrote: > > On 24/06/2024 09:27, Claude Pache wrote: > > Hi, > > Hi Claude! I really appreciate your feedback. Everything you highlighted is > an important point that will be included in the RFC! > > A general remark: I appreciate that a static class does not

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Bilge
Hi again Jordi, On 24/06/2024 21:21, Bilge wrote: Hi Jordi, On 24/06/2024 13:22, Jordi Boggiano wrote: On 2024-06-24 01:10, Bilge wrote: I am pleased to present my first RFC: Static class . Just one point of feedback: for clarity I think it would be good

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Bilge
Hi Jordi, On 24/06/2024 13:22, Jordi Boggiano wrote: On 2024-06-24 01:10, Bilge wrote: I am pleased to present my first RFC: Static class . Just one point of feedback: for clarity I think it would be good if it mentions that creating dynamic properties i.

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Bilge
On 24/06/2024 09:27, Claude Pache wrote: Hi, Hi Claude! I really appreciate your feedback. Everything you highlighted is an important point that will be included in the RFC! A general remark: I appreciate that a static class does not impose arbitrary restrictions (like: implicitly `final`) on

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Jordi Boggiano
On 2024-06-24 01:10, Bilge wrote: I am pleased to present my first RFC: Static class . Just one point of feedback: for clarity I think it would be good if it mentions that creating dynamic properties i.e. $this->dynamicProp = 'bar' would also throw at ru

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Andreas Hennings
> I am pleased to present my first RFC: Static class To recap my opinion from the other thread: I generally support the idea to have a label to slap on all-static classes, to make that contract more explicit. The goal is not to promote a specific use of the language, but to add clarity to what alr

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Claude Pache
> Le 24 juin 2024 à 01:10, Bilge a écrit : > > Hi Internals! > > I am pleased to present my first RFC: Static class > . > > This work is based on the previous discussion thread on this list of the same > name, and hopefully captured all the relevant de

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Bilge
On 24/06/2024 07:59, Alexandru Pătrănescu wrote: On Mon, Jun 24, 2024, 02:15 Bilge wrote: Hi Internals! I am pleased to present my first RFC: Static class . Hi! and good luck with the RFC. Hi Alex, and thanks for your excellent feedback!

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Ayesh Karunaratne
> > This work is based on the previous discussion thread on this list of the > same name, and hopefully captured all the relevant details, > notwithstanding anything unanticipated that may present itself during > the implementation. Let me know if you feel anything important has been > missed. I am

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Alexandru Pătrănescu
On Mon, Jun 24, 2024, 02:15 Bilge wrote: > Hi Internals! > > I am pleased to present my first RFC: Static class > . > > Hi! and good luck with the RFC. While I don't use static classes, I can see how this can be used by others. I worked in big projects tha

Re: [PHP-DEV] [RFC] Static class

2024-06-23 Thread Bilge
On 24/06/2024 00:29, Larry Garfield wrote: On the point of getting feedback on where people will vote now there's an RFC, I can only say with all honesty "Good luck." :-) This is by far the biggest challenge of making an RFC: the lack of a meaningful sense of how something will be received bef

Re: [PHP-DEV] [RFC] Static class

2024-06-23 Thread Larry Garfield
On Sun, Jun 23, 2024, at 6:10 PM, Bilge wrote: > Hi Internals! > > I am pleased to present my first RFC: Static class > . > > This work is based on the previous discussion thread on this list of the > same name, and hopefully captured all the relevant detail

[PHP-DEV] [RFC] Static class

2024-06-23 Thread Bilge
Hi Internals! I am pleased to present my first RFC: Static class . This work is based on the previous discussion thread on this list of the same name, and hopefully captured all the relevant details, notwithstanding anything unanticipated that may prese