Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114087 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65204 invoked from network); 21 Apr 2021 13:11:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 Apr 2021 13:11:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 30BDB1804DB for ; Wed, 21 Apr 2021 06:14:09 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,SPF_HELO_NONE, SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from darkcity.gna.ch (darkcity.gna.ch [195.49.47.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 21 Apr 2021 06:14:08 -0700 (PDT) Received: from wafer.home (unknown [IPv6:2a02:1205:5053:a220:8c69:518:f16c:47fa]) (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 CE60C150D069 for ; Wed, 21 Apr 2021 15:14:05 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Date: Wed, 21 Apr 2021 15:14:05 +0200 References: <004701d73549$6dbc9840$4935c8c0$@jhdxr.com> <00c501d7368e$922938f0$b67baad0$@jhdxr.com> To: PHP Internals List In-Reply-To: Message-ID: <866BBB78-85D0-4C97-87FC-63E526CDDF9F@cschneid.com> X-Mailer: Apple Mail (2.3654.60.0.2.21) Subject: Re: [PHP-DEV] [RFC] [Draft] Final constants From: cschneid@cschneid.com (Christian Schneider) Am 21.04.2021 um 14:25 schrieb M=C3=A1t=C3=A9 Kocsis = : >> My point is actually what=E2=80=99s your scenario for a final = constant? If you >> want to make sure the value you access are not changed by child = class, >> `self::` can serve the purpose already. If you want to make sure >=20 >=20 > Yes, my intention is to actually make class constant overriding = impossible > when it is desired. You can't really achieve this with only using = self::, > since you can only control your own code. Yes, I know that child = classes > could still declare a new class constant to overcome this limitation, = but > at least there will be no doubt what they should expect if they try to > override the constant value. Otherwise, they have to check whether the > parent class uses self:: or static:: calls. I never really understood the desire to restrict how people can use your = code. If there is no good reason to override the value of a class constant = people won't do it. If there might be a good reason (even one you as the original designer = didn't predict) then why not leave that door open. While I understand the theoretical benefit of being able to specify this = behavior I do think it is almost always counter productive and not a = pattern I would encourage. Especially not in a dynamic language like = PHP. - Chris