Re: [PHP-DEV] Static class

2024-06-16 Thread Andreas Hennings
On Sun, 16 Jun 2024 at 20:08, Rowan Tommins [IMSoP] wrote: > > On 16/06/2024 18:54, Andreas Hennings wrote: > > Yes, the possibility for namespace part imports exists. > Unfortunately these namespace imports usually need to be set up > manually, whereas the regular class or function import has bet

Re: [PHP-DEV] Static class

2024-06-16 Thread Rowan Tommins [IMSoP]
On 16/06/2024 18:54, Andreas Hennings wrote: Yes, the possibility for namespace part imports exists. Unfortunately these namespace imports usually need to be set up manually, whereas the regular class or function import has better automatic support from the IDE. Also, namespace fragments are ofte

Re: [PHP-DEV] Static class

2024-06-16 Thread Andreas Hennings
On Sun, 16 Jun 2024 at 19:09, Rowan Tommins [IMSoP] wrote: > > On 16/06/2024 16:24, Andreas Hennings wrote: > > For a function call, the namespace is usually only visible in the > imports list at the top of the file. > > > This is one of those interesting cases where the language itself is flexibl

Re: [PHP-DEV] Static class

2024-06-16 Thread Andreas Hennings
On Sun, 16 Jun 2024 at 17:44, Larry Garfield wrote: > > On Sun, Jun 16, 2024, at 10:24 AM, Andreas Hennings wrote: > > Regarding function autoloading: > > > > A more interesting question to me is a convention where to put each > > function. > > With classes, PSR-4 tells us exactly what one can ex

Re: [PHP-DEV] Static class

2024-06-16 Thread Lanre
Here is a relevant example usage of static classes/polymorphism on my personal site/app: https://gist.github.com/oplanre/6894f56fb61134ee5ea93cf262ba3662 On Sun, Jun 16, 2024 at 10:38 AM Andreas Hennings wrote: > Regarding function autoloading: > > A more interesting question to me is a conventi

Re: [PHP-DEV] Static class

2024-06-16 Thread Rowan Tommins [IMSoP]
On 16/06/2024 16:24, Andreas Hennings wrote: For a function call, the namespace is usually only visible in the imports list at the top of the file. This is one of those interesting cases where the language itself is flexible, but people are used to a specific style: a use statement can import

Re: [PHP-DEV] Static class

2024-06-16 Thread Larry Garfield
On Sun, Jun 16, 2024, at 10:24 AM, Andreas Hennings wrote: > Regarding function autoloading: > > A more interesting question to me is a convention where to put each function. > With classes, PSR-4 tells us exactly what one can expect to find in a > class file with a given name. > Perhaps a separate

Re: [PHP-DEV] Static class

2024-06-16 Thread Andreas Hennings
Regarding function autoloading: A more interesting question to me is a convention where to put each function. With classes, PSR-4 tells us exactly what one can expect to find in a class file with a given name. Perhaps a separate directory tree per package, with one file per sub-namespace? Or just

Re: [PHP-DEV] [RFC] Lazy Objects

2024-06-16 Thread Larry Garfield
On Sun, Jun 16, 2024, at 8:46 AM, Arnaud Le Blanc wrote: > On Sat, Jun 15, 2024 at 7:13 PM Larry Garfield wrote: >> > In practice I expect there will be two kinds of ghost initializers: >> > - Those that just call one public method of the object, such as the >> > constructor >> > - Those that ini

Re: [PHP-DEV] [RFC] Lazy Objects

2024-06-16 Thread Arnaud Le Blanc
On Sat, Jun 15, 2024 at 7:13 PM Larry Garfield wrote: > > In practice I expect there will be two kinds of ghost initializers: > > - Those that just call one public method of the object, such as the > > constructor > > - Those that initialize everything with ReflectionProperty::setValue() > > as i

Re: [PHP-DEV] Static class

2024-06-16 Thread Mike Schinkel
> On Jun 16, 2024, at 5:17 AM, Bilge wrote: > > Let's start getting specific so we can make some progress. > > The goals of this RFC are fairly straightforward: > Introduce the `static` keyword at the class level to preclude the need to > create a private constructor. That is, `__construct` wo

Re: [PHP-DEV] Static class

2024-06-16 Thread Rob Landers
On Sun, Jun 16, 2024, at 14:13, Rowan Tommins [IMSoP] wrote: > > > On 15 June 2024 18:39:20 BST, Valentin Udaltsov > wrote: > > >PHP does not have internal/private functions. > >Very often I use functions for really simple things like `array_flatten` > >(and register them via composer.json.a

Re: [PHP-DEV] Static class

2024-06-16 Thread Rowan Tommins [IMSoP]
On 15 June 2024 18:39:20 BST, Valentin Udaltsov wrote: >PHP does not have internal/private functions. >Very often I use functions for really simple things like `array_flatten` >(and register them via composer.json.autoload.files). But when the function >requires decomposition to smaller ones,

Re: [PHP-DEV] [RFC] [discussion] Correctly name the rounding mode and make it an Enum

2024-06-16 Thread Tim Düsterhus
Hi On 6/13/24 03:28, Gina P. Banyard wrote: Thank you, I think other than possibly prefixing the NegativeInfinity and PositiveInfinity cases with "Towards" I am happy with the content of the RFC. I've discussed this with Saki. In that case the `HalfEven` and `HalfOdd` modes would also need to

Re: [PHP-DEV] Static class

2024-06-16 Thread Marco Aurélio Deleu
Marco Deleu > >> You may have core developers that voted no due to maintenance burden, but if >> said maintainer is no longer active and new maintainers don't mind it, it's >> a moot argument because people changed. > > The maintenance burden argument is actually a good example of *not* bei

Re: [PHP-DEV] Static class

2024-06-16 Thread Rowan Tommins [IMSoP]
On 16 June 2024 10:27:27 BST, Rob Landers wrote: >I don’t understand why we are comparing this to a jury and/or court case. In >many countries, juries don’t even exist (such as the one I currently reside >in) so the only context is US TV shows for what that even means. Apologies, I'm from th

Re: [PHP-DEV] Static class

2024-06-16 Thread Lanre
https://github.com/oplanre/php-src/tree/feature/static-class On Sat, Jun 15, 2024 at 3:17 PM Lanre wrote: > I proposed this previously and have a working implementation, though it > may need some updates. However, I chose not to pursue it further because it > was clear it wouldn't pass as many p

Re: [PHP-DEV] Static class

2024-06-16 Thread Rob Landers
On Sun, Jun 16, 2024, at 11:17, Bilge wrote: > Let's start getting specific so we can make some progress. > > The goals of this RFC are fairly straightforward: > • Introduce the `static` keyword at the class level to preclude the need to > create a private constructor. That is, `__construct` w

Re: [PHP-DEV] Static class

2024-06-16 Thread Rob Landers
On Sun, Jun 16, 2024, at 10:33, Rowan Tommins [IMSoP] wrote: > > > On 16 June 2024 03:00:39 BST, "Marco Aurélio Deleu" > wrote: > >If you appoint a different jury to try a 20 year old case, the decision of > >the previous jury doesn't have any more weight than any other evidence on > >its o

Re: [PHP-DEV] Static class

2024-06-16 Thread Bilge
Let's start getting specific so we can make some progress. The goals of this RFC are fairly straightforward: * Introduce the `static` keyword at the class level to preclude the need to create a private constructor. That is, `__construct` would be invalid in a static class. * Prohibit ins

Re: [PHP-DEV] Static class

2024-06-16 Thread Rowan Tommins [IMSoP]
On 16 June 2024 03:00:39 BST, "Marco Aurélio Deleu" wrote: >If you appoint a different jury to try a 20 year old case, the decision of the >previous jury doesn't have any more weight than any other evidence on its own. You missed the point of the analogy. The point is that that would only ha