Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123912 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 6B03F1A009C for ; Thu, 27 Jun 2024 03:11:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719457956; bh=5XgXbAW4AVdaQyWLKXfcbLVTxc6Wh4+1MugMaKqWD5E=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=CvvyKqzEiE4UAoV0kHg1SASKYFxsKe4lM0xvrRd6qYpn5/l6UXC1SlBCduNCGDFqf 5QKfq8ZbMAaTSF5U6CdpPfo2fLclXuXvtJdpZ+HolMzuMUzsArKB4xnZ+Td+kOgWfc Z8QUZIs2dhsaNuMbaxJU78Swg+zykYnCdV6sGrU4QRRcid0tEjB2JMTBFaKmuvrGOc yIMnKy/tQFFonLDV0K4JVPjBLld6qSSM1XDoZ75o1dCxuAa7y768E0XumqX5dWVY2g lQEeFIFXxaxfEJ23EVRzWIRoS7yTnNrEvgX2O2puMfojuwtIxzX4bL1vRUzbcYfBkX qyv9E/pFqsHHA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4F886180647 for ; Thu, 27 Jun 2024 03:12:34 +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,DKIM_SIGNED, DKIM_VALID,DMARC_MISSING,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (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 ; Thu, 27 Jun 2024 03:12:33 +0000 (UTC) Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-63174692a02so70680917b3.0 for ; Wed, 26 Jun 2024 20:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20230601.gappssmtp.com; s=20230601; t=1719457875; x=1720062675; darn=lists.php.net; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=jzIzYQxAxZy00jZfugfnjlbGOn6eNqEc5RllWgkI8sA=; b=uaf51z1Xmu5qzufzuqR8lPXhMH60piibRFbkdOdQ1lk7pu0+ArAyv8wEOYojBqGFRr APDk2ROAtPwFJCeZ5WoF+7Rqi9rIUDqhzSZetDSXAxOQZcVui+/UNdekW1AdRBcZ4Kzj JZvrgRzSK8TuBjyU6x4Isz8KDVbjYcjYvT0dWRuv+g9w3bKEjCHkXr3kIxVN6Tp31+tN Rnw5AEA/fCjo2b+g6C3wa4Qv1KP0C7aCWY+Ys84nBSaxE4NEHnDJkLZ5xV2DcAlzaRpr vQNdMhrJ7BCMe4WXH09qeConyfoJjDrgu3UI3t5mAIme51YPNgB7fnhdxGN71FsOAV/7 7jmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719457875; x=1720062675; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jzIzYQxAxZy00jZfugfnjlbGOn6eNqEc5RllWgkI8sA=; b=a4u2APNUQ5MV9TU4JYS6CiBRSG+8J0/QTsQoPzGQXjfTOj9UvU3vsA0lDWjR6DqqK6 3UQbSjOo7xdLU6UaN904NjlTFYD1zSGHxgSXqUykQQeHQgihiZFSuKQpR/vuJWjWcbc0 oWZBxbWNf+DxtvcCCMAtEH0P32Z+9K5/IqU5W8R5Zlo7HBmhOhgNyZlk6Rz4tLpZShiw v8eW1Zyg9v/H8/6wNndNeF95ieVk4RFEDmRg/VbsP35uv0iJ4MuJ5DRHM0dndOk1bF1u uCKjz4jcMFGOD49PriXNL1oTlDVe0OZvi6QfEr1hb3TTOxVRyzI7ilJ5TuGHyRcBGkE6 Azzw== X-Forwarded-Encrypted: i=1; AJvYcCVV0Ua+we7mLywqT3sIu475hMZ+N2OHdzVEDsdzHUbk7/AithfBNtPXQtk726nCj2dRtXJDekG3iZ2U5Lu0C3V7IlJy/3ypHA== X-Gm-Message-State: AOJu0Yz31CL/0/6H16PRQYwDvNo1zic5JJHD/bil/vy1ntqqi/ulMBts 5cD8/SQIYVve60oPK0FLQ1c4+u4Jh0W0kleh6tQhQfTcpkqCPajYwnkpMN8YCvlmALLV2rRdAR1 655U= X-Google-Smtp-Source: AGHT+IHkSvNqK8nlamYRsduH/p7sJeSphRz4kfTvC/ClqeQ/sICsFnkI5MY+nqA0jVtaI04rR0cQjw== X-Received: by 2002:a05:690c:368f:b0:644:a37d:a8cd with SMTP id 00721157ae682-644a37db5c9mr129032587b3.17.1719457874959; Wed, 26 Jun 2024 20:11:14 -0700 (PDT) Received: from smtpclient.apple (c-98-252-216-111.hsd1.ga.comcast.net. [98.252.216.111]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6497ac2f2efsm1024837b3.132.2024.06.26.20.11.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jun 2024 20:11:13 -0700 (PDT) Message-ID: <662F259B-D125-48EA-8AA0-1DC8BECA4C09@newclarity.net> Content-Type: multipart/alternative; boundary="Apple-Mail=_0D7642A0-535A-45A9-B432-BEE2404568D7" Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: [PHP-DEV] [RFC] Static class Date: Wed, 26 Jun 2024 23:11:13 -0400 In-Reply-To: Cc: Claude Pache , php internals To: Stephen Reay References: <88D83E92-94BE-4548-B398-8F5C74765FFD@gmail.com> <882BD9E0-42E9-4C84-A144-7C1DFC4CE5EB@newclarity.net> X-Mailer: Apple Mail (2.3696.120.41.1.8) From: mike@newclarity.net (Mike Schinkel) --Apple-Mail=_0D7642A0-535A-45A9-B432-BEE2404568D7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Stephen, > On Jun 26, 2024, at 4:26 AM, Stephen Reay = wrote: >=20 > This is an example of code that works today (and all the way back to = 5.0): https://3v4l.org/4EKo2 >=20 > The class hierarchy embody the type of classes this RFC is about: only = static members, no instantiation.=20 >=20 > The *implemented methods* can be called statically, regardless of = whether the class they're implemented in is abstract or not. The = *abstract methods* cannot be called directly. >=20 > So these classes would be a candidate for the `static` class keyword = (or Attribute) - except they can't, if calls to implemented methods on = abstract classes are disallowed. Because the Base::a() method has been = publicly callable, for potentially as long as 20 years = next month. >=20 > My point here is that if someone wants to prohibit calling public = static methods on abstract classes *with* the static keyword, that's = going be inconsistent with how it's worked for the last 20 years (i.e. = on classes that were 'static' in intent but not syntactically), or if it = applies the change everywhere it's going to be a BC break. It seems what you are asking about is downstream from the reason I = stated that I made the argument in the first place, which AFAICT you did = not acknowledge. That leaves me unsure of your position on a precursor = topic to your above stated objections. As stated, my primary (initial) reason for arguing that `abstract = static` should disallow calling static methods using the class name of = the static class marked abstract =E2=80=94 as my earlier example of = calling `Base::foo()` illustrated` =E2=80=94 was in response to the = argument against allowing `abstract` with `static` because =E2=80=94 in = Claude's words =E2=80=94 it would "have no real semantic meaning for = static class; their effects on static members are only consequences of = their intended meaning on non-static class." I have copied his complete = words on that topic below: > On Jun 24, 2024, at 4:27 AM, Claude Pache = wrote: >=20 > Should a static class be marked `abstract`? I think not, because those = have no real semantic meaning for static class; their effects on static = members are only consequences of their intended meaning on non-static = class: >=20 > * The main purpose of the `abstract` keyword is to prevent a class to = be instantiated, which (in case of static class) is more semantically = described by the `static` marker. Beyond that, it just allows to declare = a method that, if implemented by a subclass, should have a compatible = signature. Most notably, it does not prevent the other static members of = the class to be used directly. Thus my argument supporting `abstract static` was addressing his = objections by suggesting that we could have an `abstract static class` = declaration *disallow* calling any of the `static` methods of the class = using the name of the class declared `abstract` given that it would in = fact not cause any BC breaks with untouched code.=20 Before you repeat your objections to disallowing, permit me to ask you = which of the following upstream arguments you are making? Is your = position that we should: 1. Disallow `abstract` on `static` as Claude argued? 2. Allow `abstract static` in spite of Claude's argument against it? Also, if you answer "2. Allow `abstract static`" then please how do you = address Claude's objections? Once I am clear of your position on two above I will address your = objections stated in your most recent response to me, which I quoted at = the beginning of this email. Thank you in advance for the clarity. -Mike= --Apple-Mail=_0D7642A0-535A-45A9-B432-BEE2404568D7 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi = Stephen,

On Jun 26, 2024, at 4:26 AM, Stephen Reay <php-lists@koalephant.com> wrote:

This is an example of = code that works today (and all the way back to 5.0): https://3v4l.org/4EKo2

The class hierarchy embody the type of classes = this RFC is about: only static members, no = instantiation. 

The *implemented methods* can be called statically, = regardless of whether the class they're implemented in is abstract or = not. The *abstract methods* cannot be called directly.

So these classes would = be a candidate for the `static` class keyword (or Attribute) - except = they can't, if calls to implemented methods on abstract classes are = disallowed. Because the Base::a() method has been publicly callable, for = potentially as long as <checks notes>  20 years next = month.

My = point here is that if someone wants to prohibit calling public static = methods on abstract classes *with* the static keyword, that's going be = inconsistent with how it's worked for the last 20 years (i.e. on classes = that were 'static' in intent but not syntactically), or if it applies = the change everywhere it's going to be a BC = break.

It seems = what you are asking about is downstream from the reason I stated that I = made the argument in the first place, which AFAICT you did not = acknowledge. That leaves me unsure of your position on a precursor topic = to your above stated objections.

As = stated, my primary (initial) reason for arguing that `abstract static` = should disallow calling static methods using the class name of the = static class marked abstract =E2=80=94 as my earlier example of calling = `Base::foo()` illustrated` =E2=80=94 was in response to the argument = against allowing `abstract` with `static` because =E2=80=94 in Claude's = words =E2=80=94 it would "have no real semantic meaning for static = class; their effects on static members are only consequences of their = intended meaning on non-static class."  I have copied his complete = words on that topic below:

On = Jun 24, 2024, at 4:27 AM, Claude Pache <claude.pache@gmail.com> wrote:

Should a static class be marked `abstract`? I think not, = because those have no real semantic meaning for static class; their = effects on static members are only consequences of their intended = meaning on non-static class:

* The main = purpose of the `abstract` keyword is to prevent a class to be = instantiated, which (in case of static class) is more semantically = described by the `static` marker. Beyond that, it just allows to declare = a method that, if implemented by a subclass, should have a compatible = signature. Most notably, it does not prevent the other static members of = the class to be used directly.

Thus my argument supporting = `abstract static` was addressing his objections by suggesting that we = could have an `abstract static class` declaration *disallow* calling any = of the `static` methods of the class using the name of the class = declared `abstract` given that it would in fact not cause any BC breaks = with untouched code. 

Before you repeat your objections to disallowing, permit me = to ask you which of the following upstream arguments you are making? =  Is your position that we should:

1. Disallow `abstract` on = `static` as Claude argued?
2. Allow `abstract = static` in spite of  Claude's argument against = it?

Also, if you answer "2. Allow `abstract static`" then please = how do you address Claude's objections?

Once I am clear of your position on two = above I will address your objections stated in your most recent response = to me, which I quoted at the beginning of this email.  Thank you in = advance for the clarity.

-Mike
= --Apple-Mail=_0D7642A0-535A-45A9-B432-BEE2404568D7--