Seriously? Are you really this stupid or just feigning ignorance? How is this a global:
class X {
private static $count = 0;

}

I am no longer pushing this RFC because idiots like you are in charge of the votes but seriously your argument is dumb as fuck. If you aren't sure then why say anything before looking more into it? A class level static is not equivalent to a global in any sense and if I have to explain the differences to you, you are not in a position to be speaking this confidently.

This isn't me taking anything personally, i have just come to the realization that this community is not for me, so you guys can have fun jerking each other off, and I will keep my ideas to myself.

Cheers,

Lanre

On 2023-11-23 10:55 a.m., Larry Garfield wrote:
On Thu, Nov 23, 2023, at 1:43 AM, Robert Landers wrote:

I'd venture to say that static classes have some unique benefits over
plain functions. One, you can encapsulate state using private static
variables. That simply isn't possible with regular functions (unless
you use static variables in the functions themselves, which isn't
quite the same thing).
It's close enough to the same thing that it has the same problems.

As far as I am aware, a static variable in a function is stored in global 
memory as a singleton.  It's logically the same as a global variable, but with 
access restricted to one function.

A static property of a class is also stored in global memory.  It's logically 
the same as a global variable, but with a funny name that has colons in it.  It 
may be access restricted depending on the code.

(Engine experts, if I am subtly wrong there please do correct me.)

So static variables and static properties are both simply "globals with funny 
extras."  And global-maintained state is well known and understood as a bad idea 
that hinders testing, refactoring, tractability, maintenance, and everything else 
developers care about.

Using global state, with or without funny syntax around it, is the anti-pattern 
we should not be encouraging.

Generally speaking, even my prototypes eschew globals and statics in 95% of 
cases.

--Larry Garfield


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to