Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120125 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 89819 invoked from network); 25 Apr 2023 14:07:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Apr 2023 14:07:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4B74F180545 for ; Tue, 25 Apr 2023 07:07:33 -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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS29838 64.147.123.0/24 X-Spam-Virus: No X-Envelope-From: Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 25 Apr 2023 07:07:32 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 9B40D320092F for ; Tue, 25 Apr 2023 09:28:35 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute4.internal (MEProxy); Tue, 25 Apr 2023 09:28:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1682429315; x=1682515715; bh=Tf1Hpu3L72 RTkJjaJYcbSSlBi3rTO/R2tL8Vlkj7os4=; b=oTvH59fbhUZrWG5/KFd956PZDG anhXatFDgF/MKGVzfLIUYF2lfy6sT+LDpUBF92GDgQw3Cc03yb7Ap7HIF77AFudI dgAnlPPDzXzuiNjTQXHMj55QFeZm3H0IUcVY42p5GeLnzR5nSPipuJ1XRnT50hM2 Ujdzfwjm85iJDsstkpcKfTwlPJespRFHfTVtVKzJPK7vJ/kfgo0NE9KIhI3aLEzE lvCJ7qk8IyQWYvd6fKJB7frgBY2lPOAabzjAw0uKM4u9OUTL58mD70ZWPaBVhubn TX8WO1fMSHB8odObMG4xHQuRM/IISXeaCJz+AIy5uP+fiD5k5Quwcob3H9IQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1682429315; x= 1682515715; bh=Tf1Hpu3L72RTkJjaJYcbSSlBi3rTO/R2tL8Vlkj7os4=; b=Y IZEZuXW0jkogOsFtLBMDyg+z3IeUcqnEeMZfouYapbP2h9uiLaWPJZww68XcuiIY rc1qIo1m9hbfIV4thJ72FrkmemjgvUckxljobcBkEn/zQOuBk+zy3ehdWTJX5KW4 TdH5xBOQ8ScF5w1V45DYwxEoB1NmAjOkcN/JAuGwfcH5XRBO+ENAFuhxHa46FiXG 6RJmZvgocm7zf0sswXZGLSpCv/y5PyACFMJOhVvadAZMtXRjw73R+p/qIKXLObxX 372xOwSnOI9BT0dCLnQQuwA4lxvsZfKoRImevd7yiPtNNcKuSEnUjB4xz8sZeqXu lG1lq8fUsPETo1PfszFMg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeduvddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhushhpvggtthffohhmrghinhculdegledmnecujfgurhepofgfggfkjghffffhvffu tgfgsehtqhertderreejnecuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufdcuoe hlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqnecuggftrfgrthhtvghrnhep veeggffgffethefhvefgudffgeetkeekhfeljeelvedtvefgudevkeehheevgeeunecuff homhgrihhnpehgihhthhhusgdrtghomhdpfehvgehlrdhorhhgnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlh guthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id D44361700089; Tue, 25 Apr 2023 09:28:33 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-374-g72c94f7a42-fm-20230417.001-g72c94f7a Mime-Version: 1.0 Message-ID: <2bb9cda9-4bf8-49c8-aaec-7797c504d8e4@app.fastmail.com> In-Reply-To: References: <67b1e9b0-b7c6-71d4-cad2-2286edab759b@daniil.it> <2F21E8B8-190F-4E46-B42C-5EB490EE2AF7@gmail.com> Date: Tue, 25 Apr 2023 13:28:13 +0000 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Final anonymous classes From: larry@garfieldtech.com ("Larry Garfield") On Tue, Apr 25, 2023, at 1:21 PM, Ilija Tovilo wrote: > Hi Claude > >> > Hi all, >> > >> > I've submitted https://github.com/php/php-src/pull/11126 to add sup= port for final anonymous classes, though as noted by iluuu1994, it would= probably make more sense to just make all anonymous classes final by de= fault, what do you think? >> >> Extending an anonymous class is indeed possible (https://3v4l.org/pDF= TL), but it is a hack as best. If someone wants a non-final class, could= they not write a non-anonymous one? As a bonus, they wouldn=E2=80=99t n= eed to instantiate the class before referencing it. > > Indeed. The argument was that, if you need to give the anonymous class > a dedicated name through an alias to extend it, you might as well > declare a named class in the first place. > > In case somebody finds benefit in making anonymous classes open, it > seems more sensible to make them opt into openness, rather than > applying this behavior to all anonymous classes that are used as final > 99.9% of the time. Although I really don't think that is necessary. > > Ilija I agree, but that would then require adding some kind of "non-final" key= word for anon classes to opt back out of finalness. That's an extra com= plication I don't see as worth the effort to think through. Until this thread it hadn't even occurred to me that you could extend an= anon class at all, so the issue never came up. And the apparent way to= do so involves eval(), so I'm already afraid of it. Given how edge-cas= ey this is, I'd be inclined to just leave it be. --Larry Garfield