Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114128 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 7545 invoked from network); 24 Apr 2021 15:55:42 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Apr 2021 15:55:42 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BDD5B1804C6 for ; Sat, 24 Apr 2021 08:59:16 -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=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from sender4-of-o56.zoho.com (sender4-of-o56.zoho.com [136.143.188.56]) (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 ; Sat, 24 Apr 2021 08:59:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619279945; cv=none; d=zohomail.com; s=zohoarc; b=Kuu8z0OVKz/AY/Qy2adz+UBRd/5vtwCZmlmSBmk4IR8Mf1jn+FkL3I+AEt8u6b8lZdCWP4d7cx2wW1dH0vTqaD+qIN6BSQVZ5QtTsOH6+CCfR1vfUnzTRwScIN0OefcNgn3XPBWf3OjrZFWD35zUPawS/IUjCCCu8T5ymXMJbrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619279945; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ZUqcQ5wAywaO33RO/0WMFYSJpXqD+sydQ8iLCc6VYoI=; b=PoBlDdtk2KbhNyO+OLrkG6+n0Rzvj77ZSRivMsQtwTCrxnRwr5cW5xccGY441b37IvCfC3J255gi7zAccGvQZFRp3iLlnVGg96raunkkvJ0jYE0APpXiNky3mN48YLdiRyn0pu3TUAXgo2YX3hrH5i16UPM307MF9Kpjyf1fTzA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass smtp.mailfrom=azjezz@void.tn; dmarc=pass header.from= header.from= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1619279942795991.6687758034333; Sat, 24 Apr 2021 08:59:02 -0700 (PDT) Date: Sat, 24 Apr 2021 16:59:02 +0100 To: =?UTF-8?Q?=22Olle_H=C3=A4rstedt=22?= Cc: "Pierre" , "Saif Eddin Gmati" , "PHP Internals" Message-ID: <179049b1475.11134368b213512.254739612773841999@void.tn> In-Reply-To: References: <5b9f1500-615a-48f1-815f-1d48b327ef90@processus.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_690090_41037685.1619279942773" Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Subject: Re: [PHP-DEV] [RFC][Draft] Sealed Classes From: azjezz@void.tn (Saif Eddin Gmati) ------=_Part_690090_41037685.1619279942773 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > Doesn't this violate the principle: It should be possible to add new feat= ures without touching old code?=20 This depends on which syntax is picked, both `for` and attribute syntax wil= l be completely BC. using `sealed`+`permits` or `permits` only will result in these keywords be= ing reserved, so classes named `Sealed` or `Permits` will not work in PHP 8= .1. =20 > Isn't namespace-internal access a better feature for the same purpose? Th= at is, only allows a class to be extended within the same namespace.=20 No, this is a different feature, sealed classes can permit classes in a com= pletely different namespace, and restrict inheritance to a per-defined list= of classes. If we would allow inheritance in the same namespace, it's extremely easy to= get around it: ``` namespace Lib { =C2=A0 abstract class MyProxy implements PrivateFooInterface {} } namespace App { =C2=A0 class MyFooImplementation extends \Lib\MyProxy { =C2=A0=C2=A0=C2=A0 // ... =C2=A0 } } ``` while it is possible to get around sealed, or even final keywords ( https:/= /github.com/dg/bypass-finals/blob/master/src/BypassFinals.php ), bypassing = private classes/interface is much easier, and doesn't require any hacks. ---- On Sat, 24 Apr 2021 16:52:20 +0100 Olle H=C3=A4rstedt wrote ---- 2021-04-24 12:56 GMT, Pierre :=20 > Le 24/04/2021 =C3=A0 12:55, Saif Eddin Gmati a =C3=A9crit :=20 >> Hello Internals,=20 >>=20 >> I'm sending this email to open discussion about sealed classes,=20 >> interfaces, and traits feature for PHP 8.1.=20 >>=20 >> I have create a Draft RFC here:=20 >> https://wiki.php.net/rfc/sealed_classes=20 >> =20 >>=20 >> A major concern for few people have been the syntax, in which it=20 >> introduces 2 new keywords into the languages, therefor, i have added a= =20 >> section about alternative syntax which could be used to avoid this=20 >> problem.=20 >>=20 >> Regards,=20 >>=20 >> Saif.=20 =20 1) Doesn't this violate the principle: It should be possible to add=20 new features without touching old code?=20 =20 2) Isn't namespace-internal access a better feature for the same=20 purpose? That is, only allows a class to be extended within the same=20 namespace.=20 =20 Olle=20 =20 --=20 PHP Internals - PHP Runtime Development Mailing List=20 To unsubscribe, visit: https://www.php.net/unsub.php ------=_Part_690090_41037685.1619279942773--