Re: Static class

From: Date: Sun, 16 Jun 2024 15:43:35 +0000
Subject: Re: Static class
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
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 directory tree per package, with one file per sub-namespace?
> Or just a package-wide functions.php?
>
>
> Regarding static methods vs functions.
>
> From the older thread, I can see different levels of possible
> objection to all-static classes:
> 1. "Every static method should instead be either a non-static method,
> or a regular procedural function."
> 2. "Static methods are acceptable, but no class should exist that has
> only static methods."
> 3. "Static methods and all-static classes are acceptable, but no new
> language feature is needed to specifically support all-static
> classes."
> 4. "A new language feature for all-static classes could be acceptable,
> but it should be very minimal and declarative."
>
> I see myself somewhere between 3 and 4.

For reference, I have documented my stance on statics here: 

https://peakd.com/hive-168588/@crell/cutting-through-the-static

--Larry Garfield


Thread (32 messages)

« previous php.internals (#123638) next »