Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121755 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49613 invoked from network); 22 Nov 2023 13:29:40 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Nov 2023 13:29:40 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9B06118002B for ; Wed, 22 Nov 2023 05:29:42 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail.gna.ch (mail.gna.ch [212.45.196.109]) (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 ; Wed, 22 Nov 2023 05:29:41 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id 569C23A0F56 for ; Wed, 22 Nov 2023 14:29:36 +0100 (CET) X-Virus-Scanned: amavisd-new at example.com Received: from mail.gna.ch ([127.0.0.1]) by localhost (darkcity.gna.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 33B2eMcuW-4S for ; Wed, 22 Nov 2023 14:29:35 +0100 (CET) Received: from smtpclient.apple (unknown [194.169.219.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id D3FA93A0A3B for ; Wed, 22 Nov 2023 14:29:35 +0100 (CET) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.200.91.1.1\)) Date: Wed, 22 Nov 2023 14:29:35 +0100 References: <79d675e3-95b4-40bb-baf4-3e1c998f5390@online-presence.ca> To: php internals In-Reply-To: Message-ID: <99D672A1-7D00-49CF-B49B-90081881DB1F@cschneid.com> X-Mailer: Apple Mail (2.3774.200.91.1.1) Subject: Re: [PHP-DEV] RFC Proposal - static modifier for classes From: cschneid@cschneid.com (Christian Schneider) Am 20.11.2023 um 22:00 schrieb Lanre Waju : > I will have to disagree with everything you said: Side-note: This is IMHO not a good intro into a discussion ;-) > I outlined what a static class would be: A class that cannot be = instantiated in which all members are implicitly static. We already have = static members, so please elaborate on the maintenance burden that = adding static to a class as that could help explain better, i mean what = feature doesn't have technical debt associated with it? The new JIT = engine? That is his point: The benefit has to outweigh the debt and for = something like a class modifier this can lead to a matrix of possible = combinations, complication things down the line. >>> 3. It is entirely opt-in. If you hold reservations about using = static >>> classes, you can simply choose not to use them. >> This is a spurious and disingenuous argument, even if it gets trotted = out frequently on many RFCs. I'm not picking on you in particular here, = but it's a bad argument to use, period, 99% of the time, no matter who = is saying it. > If you insist, Mr. Larry. I=E2=80=99m with Larry there: Being able to just ignore new features is = sometimes helpful (i.e. avoids the discussion about BC) but not a strong = argument on *why* something should be added. This lists very much also = cares about the implementation and maintenance costs as well as the = simplicity/consistency of PHP. Being opt-in just does not carry much = weight in that context. >> Similarly, if we add a static marker to classes, that means all = future improvements to classes need to consider "but what if the class = is static?" Eg, there was discussion a while back about `data` classes. = What happens if you have a `static data class`? Is that a syntax = error? Does it work? If it works, what does "work" mean? What about = sealed classes? Can you have a sealed static class? What would that = mean? Those are questions that would need to be answered, because this = feature exists. > Either i'm in an alternate reality where the data classes and sealed = classes rfcs passed, or I've just been straw-manned. Either way, is it = really that difficult to decide on as a community what a static data = class implies? We have already established that a static class means all = the members are static, but i can try to dumb it down for you if need = be. Being a long time member of this list (even though with only very = occasional contributions to the source code) I have to say: There is a = wide range of experience in both language design and implementation (for = both PHP and in general) represented here, some members coming from an = almost exclusively language-user point of view. And that is a great = thing! But I=E2=80=99d recommend to not underestimate the knowledge contributed = by people who have been involved for some time and possibly even learned = from previous mistakes :-) Having said all that I just wanted to add that I would most probably = vote against static classes even though we use class-as-a-namespace here = sometimes but still don=E2=80=99t feel the need for it to being a = language feature for the reasons mentioned by Rowan and Larry. Regards, - Chris