Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123992 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 0CEB51A009C for ; Fri, 28 Jun 2024 18:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719597961; bh=A6pNYOJ3VsrBUjr0hHE8fYow1imEPIpLJARVazVnpnI=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=a+ZiJVKT+cSKc7XzIPHzwla8+55cef+ryGGLbpfcNTV7vDSus5x1zrDkUJk5AfCI3 l8u8DzPG0Ai1+fQeXav3w987kNa8U++sNl3kdlntS4sOLgmFKCXpHCMNNYdpAW8UW5 bqT+Mg9YpP9m74W9m49rIOTAhA9xhgINu8Z6++kRwZ6Jyu2Y9X0dZJC6GtLAY3IbP6 AciLJX1r/FGPpJN9XkQsYKZ1o1SqlxRaUWIQWm3z1RwtLjvukQCjics1qXdmJXy0qZ qQiKxN+7wGQ4/nTw5OAtFskc/Ua1hlRRLq7aom6ctpMpBF2Rp0OiFPUyum2qd23RNF 9Y9x+lRvZO5vg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 54DC31805F9 for ; Fri, 28 Jun 2024 18:06:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DMARC_MISSING, HTML_MESSAGE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail1.25mail.st (mail1.25mail.st [206.123.115.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 28 Jun 2024 18:05:59 +0000 (UTC) Received: from smtpclient.apple (unknown [49.48.245.197]) by mail1.25mail.st (Postfix) with ESMTPSA id 37BBF60500; Fri, 28 Jun 2024 18:04:25 +0000 (UTC) Message-ID: <4148946E-7D16-46F8-8B88-9C7C5D61D129@koalephant.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_B115DD9C-B5F6-42CD-ABA4-A9F56AF56900" Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: [PHP-DEV] [RFC] Static class Date: Sat, 29 Jun 2024 01:04:12 +0700 In-Reply-To: Cc: Mike Schinkel , =?utf-8?Q?Tim_D=C3=BCsterhus?= , Bilge , php internals , lnearwaju@gmail.com To: Lynn References: <554ffb9e-35c5-466e-aace-0501eee3d0bd@bastelstu.be> <6452BECC-BB20-48DC-9595-324EA70E6A67@newclarity.net> X-Mailer: Apple Mail (2.3774.600.62) From: php-lists@koalephant.com (Stephen Reay) --Apple-Mail=_B115DD9C-B5F6-42CD-ABA4-A9F56AF56900 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 28 Jun 2024, at 14:05, Lynn wrote: >=20 >=20 >=20 > On Fri, Jun 28, 2024 at 2:48=E2=80=AFAM Mike Schinkel = > wrote: >> >> and inheritance is not meant for code reuse. >>=20 >> 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. >=20 > 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? Hi Lynn, I understand it's frustrating when there are bugs/unexpected behaviour, = but wouldn't the (existing) *ability* to add the `final` keyword to a = class solve those issues for you, without preventing others from using = the capabilities of parent/child class relationships? Cheers Stephen=20= --Apple-Mail=_B115DD9C-B5F6-42CD-ABA4-A9F56AF56900 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 28 Jun 2024, at 14:05, Lynn = <kjarli@gmail.com> wrote:



On Fri, Jun 28, 2024 at 2:48=E2=80=AFAM 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?

Hi Lynn,

I = understand it's frustrating when there are bugs/unexpected behaviour, = but wouldn't the (existing) *ability* to add the `final` keyword to a = class solve those issues for you, without preventing others from using = the capabilities of parent/child class = relationships?


Cheers

Stephen 
= --Apple-Mail=_B115DD9C-B5F6-42CD-ABA4-A9F56AF56900--