Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123984 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 764A51ADD38 for ; Fri, 28 Jun 2024 07:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719558440; bh=phTJ/1aMJx4DDILYfsuad2qvL/rxvfrRLymYIF4YL0I=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jxSpo2PI+8lFrbp87jwmFST5XZnF2q3uEK3mZ719pwTFrlclLJh0qtnq/CwF/cUAJ D9V7JsUYWjpUo7My0inxYsFmsQ/2oA69b+78RYxk9vTyfns+f5U6vlw9Cyz98x/f/q Cj/Ksya1iZj3978fdtegtPQRwS6ceymOSAPlOIYe+Xhxy/1DT75Gw1ZpYI4y+nUwCL zyBJCZQMJJhwhM6/4es/6Xl91IbXkjnj9o4W2TVAV0zyEPapcCzZObDGn9xGqZSP/h PAyL0U2v4XrEJphJn9kLReSsnM8kDD9lIJYArpcwbvOXinAuW17uTbqd+0XvZG3+lC plM5qknT7/Kog== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DC6261806E3 for ; Fri, 28 Jun 2024 07:07:18 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 28 Jun 2024 07:07:15 +0000 (UTC) Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-57d20d89748so277469a12.0 for ; Fri, 28 Jun 2024 00:05:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719558356; x=1720163156; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=phTJ/1aMJx4DDILYfsuad2qvL/rxvfrRLymYIF4YL0I=; b=KmCn6+y8gOQC4IuiASVil9YNw+UmsFcNi9cR4J/aYrKdCs8do2bkwGHSle7xQnn0rc SPo8HtNlfO+R6id7wFAkcYVXKSwSQskeBBvfDlkhCuVwWP+0hNEzEyVZfcPxXUgsLWKP GAUr2y4zXcYVb52CYZeiO+g6d4/k6j15B4RbmiThfwzHOhbffh4P+vw/JU82V8CMba6g G8hDTRcsLffhgQDrW8KohQjU+9soDP+QKXu9bjP1iffuKQ54zRrOY8whl7/VIcqdMhgz bdph3D/HdR9yovVBFhdsVm9YpidxL/noSfafiReJH5YSFXopcZmh14/tYlQeO6sRKYBh REiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719558356; x=1720163156; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=phTJ/1aMJx4DDILYfsuad2qvL/rxvfrRLymYIF4YL0I=; b=tWxTY37u3w1dK3C9Utz+ybpuIgRXjgr52IsqFG4gBs4cWSilNwkph2YXOkgAWdstux C9kpmtiVgAOQneO9GHfGCDbFkE0Kqw9ckigzrVbjWzI8Cp1IOp7hzYDBXU2b41CYHhEc WJHhiR3PiltOxj9qoOUzRDDZi3lC7+hYQK2TdityVmxHz3luzNNp2R/YEqVkOCG9JBd3 /EJCpYLixvsITwuE8KLNddfcrunTS4aCSO1ycxny7vPzu3OrFABFZKtImBhX3tUlyuRu lYmWggRy239Bl9otmQEtJmBWz55u4F0/x6gi1Cd2k8k6sG0u41/ZvfUcgkoZZZ4RfIMv KPlw== X-Forwarded-Encrypted: i=1; AJvYcCXt3JkLohZLrbyDMeiaFpOz9zft7G7L2fsSs1gMxog6SFDO9xKxi7hrxu+KNCvtuDZGw9gTWSNkoD0I7ZWClBrxd54l4Uydyg== X-Gm-Message-State: AOJu0Yy+6I3i+y9ONY8xczFjLiJSLVeXOzm6F7yeg1gdq/wPqeZlqhPg Xff4jvKHKamWCJjV7qJ06pQsOOmbzq9u92b0E4Yf07qMnr50wwrnO2TihAGTpKPk29ZONj780lm LM5JdVOx+kHQGkuc9hFJFGOyG7xs= X-Google-Smtp-Source: AGHT+IEC8xAZ6mCtZu/5/TJEdfVyGcMpGT6MVTHLeXj+grBIgniZCE5+JqouMiBMfjxgYLy4blrUWEwBWLosSs8EYmI= X-Received: by 2002:a17:906:af97:b0:a6f:b98e:9aa4 with SMTP id a640c23a62f3a-a7242db3453mr1043012466b.61.1719558355360; Fri, 28 Jun 2024 00:05:55 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <554ffb9e-35c5-466e-aace-0501eee3d0bd@bastelstu.be> <6452BECC-BB20-48DC-9595-324EA70E6A67@newclarity.net> In-Reply-To: <6452BECC-BB20-48DC-9595-324EA70E6A67@newclarity.net> Date: Fri, 28 Jun 2024 09:05:28 +0200 Message-ID: Subject: Re: [PHP-DEV] [RFC] Static class To: Mike Schinkel Cc: =?UTF-8?Q?Tim_D=C3=BCsterhus?= , Bilge , php internals , lnearwaju@gmail.com Content-Type: multipart/alternative; boundary="000000000000f12658061bede0d0" From: kjarli@gmail.com (Lynn) --000000000000f12658061bede0d0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jun 28, 2024 at 2:48=E2=80=AFAM Mike Schinkel = wrote: > >> and inheritance is not meant for code reuse. > > Just because code reuse in inheritance can be problematic it does not hav= e > 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 wit= h > 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? --000000000000f12658061bede0d0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Jun 28, 2024 at 2:48=E2=80=AF= 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 inher= itance 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 def= ault for the=C2=A0sake of consistency, though my preference would be to avo= id 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=C2=A0problem of ho= rizontal=C2=A0reuse?
--000000000000f12658061bede0d0--