Re: [RFC] Static classes (Was Abstract final classes)
| From: | Rowan Collins | Date: | Mon, 01 Dec 2014 21:56:24 +0000 |
| Subject: | Re: [RFC] Static classes (Was Abstract final classes) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-79359@lists.php.net to get a copy of this message | ||
On 1 December 2014 20:30:46 GMT, Andrea Faulds <ajf@ajf.me> wrote:
>
> The problem is that, well, global state is rarely a good thing, I don’t think we should be
> encouraging it.
To get a bit philosophical: Is it really the language's job to make that decision? Is there a
difference between "encouraging", "allowing", and "enabling"?
Purely static classes are a reality whether this feature is added or not. They do things namespaces
can't (and probably shouldn't), but are simpler to work with than singletons (which they
closely resemble) or full-blown Dependency Injection. Declaring a static class is just a way of
acknowledging that this is a deliberate decision, and instance members should not be added.
Regards,
--
Rowan Collins
[IMSoP]