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 static methods, or else you incur the overhead of creating an object for stateless functions. How do you propose handling such cases using namespaced functions? Can you think of any scenarios where hiding non-API functions might be necessary? I'm curious why you keep returning to namespaced functions when they don't fulfill the same role.
Cheers, Lanre On Tue, Jun 25, 2024 at 9:20 AM Derick Rethans <der...@php.net> wrote: > 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 > > > <https://wiki.php.net/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 present itself during > > > the implementation. Let me know if you feel anything important has > been > > > missed. I am aware it omits to mention specifics about messages so > > > emitted when runtime or compile-time errors occur, but I anticipate > this > > > can be hashed out in the PR, unless consensus indicates otherwise. > > > > > > I am aware this idea is not supported by everyone, but there seemed to > > > be enough positive voices for it to be worth a shot. I'd like to get a > > > better idea of where people might stand when it comes down to a vote, > > > now there is a formal RFC, so we know whether it's worth completing > the > > > implementation, although any sentiments so proffered are of course not > a > > > commitment to vote any particular way and nobody should feel compelled > > > to speak to that unless comfortable. Looking forward to feedback! > > <snip> > > > > For the record, as previously stated, I will be voting No on this RFC. > > 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. > > cheers, > Derick >