Re: [RFC] Static class

From: Date: Fri, 28 Jun 2024 17:07:30 +0000
Subject: Re: [RFC] Static class
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-123990@lists.php.net to get a copy of this message
On Fri, Jun 28, 2024 at 1:05 AM Lynn <kjarli@gmail.com> wrote: > > > On Fri, Jun 28, 2024 at 2:48 AM Mike Schinkel <mike@newclarity.net> wrote: > >> >> and inheritance is not meant for code reuse. >> >> Just because code reuse in inheritance can be problematic it does not >> have to be in all-cases. Moderation in all things. I used that approach for >> 10+ years and never once had any of the problems people claim about using >> inheritance for code reuse. This was likely because my needs were >> constrained by the use-case and by nature did not grow out of control with >> complexity. >> > > My experience is the opposite. There are subtle bugs I keep running into > with static function and properties causing unexpected behavior. I'm not > against having static classes open by default for the sake of consistency, > though my preference would be to avoid the headache altogether and just > make them final by default so I won't ever have to deal with it. Would > traits not solve the problem of horizontal reuse? > Sounds like a 'you' problem. Can you go into more details about said subtle bugs? With examples if possible? Lanre

« previous php.internals (#123990) next »