Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120123 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85320 invoked from network); 25 Apr 2023 13:22:06 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Apr 2023 13:22:06 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7E7421804F8 for ; Tue, 25 Apr 2023 06:22:04 -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.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 06:22:04 -0700 (PDT) Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-63b7096e2e4so4812344b3a.2 for ; Tue, 25 Apr 2023 06:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682428923; x=1685020923; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1oSKfIu0NicNgwm85l/4xMKWdzkNaNo5kbIstyf3rN4=; b=d13sykiXLY6r16wfNS00CF3Iw+tzGi7fdaIZS2W6M7htE3ZlC7VG9Em9nXN8Rj6Hbp OIeb2LpE319H2sODZddoBh47/G3AgU+tgpplHZbD3bLSobPJn/InH3NVPYpYxwmzmsTK ZGP+vxmevd8ozdCFh2pbWYDXLkbQbNEmUuhYVaT8QB1Oo1GHOg8KfztjL3Pt9OapwKHV utqSEmFbXq1ky1sgdXQzea/eB/5Rt0qv3F926GDCCWErzezDmpp4/yia2V8vQ/nG+5JG 5LcZpVfM1Y3+GtowFZ4+6qmEEcq9bruPxLjHSZrDpjd2taQj69/mJIbUT1ckZhhu4tSW ssuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682428923; x=1685020923; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1oSKfIu0NicNgwm85l/4xMKWdzkNaNo5kbIstyf3rN4=; b=JiyjKnucm6qJfpiiOkxVKYPcy4W6aZdhfnUMqaET9UQHNhILpBbGyzK5/5cAOLKJhp 6SQMIZLDl6qgdtV3UYyJmsE2XxptmimGAACl/RCanZUI1NfvRYC3dyeJnDWO6Hz/LDip G759VQkqpOv/pSSjGezsiiV3SuwUeXkR3mAUvjvpl7ReYgpD0MrjRu2clXWc58R2V0vQ FDvn/uqF9FATGUOfrcUuUANzpwHSJzdoUk/vPddqMdegGcY6g1aLfPwH0EVp+jqcg0Ve 4Zx6ESBD5Cxr/4lInYstGVLoLHH6KcCfNs3jlAFhdMTuROsBUXpS+WsY2dOk4iGheTvR cu5w== X-Gm-Message-State: AAQBX9cXuEHgHLUK+N3FH5qQQOm5pm5pZPSk1NIBEuPrWZlhYtyXM9rM 9pUfpqIzIqW2APy4MVNFPpkFEysZGkpUFk2W6fFYYXoO X-Google-Smtp-Source: AKy350aAub+Akr9cjj5VswB8ZQ6vuRC4KMvTLePyd+6I8AjypaVV9+SXhaApYuLttdUYZlYRwUBnvrz2TTqNuKUwruw= X-Received: by 2002:a05:6a20:7fa0:b0:f5:c6e5:e65 with SMTP id d32-20020a056a207fa000b000f5c6e50e65mr4807675pzj.7.1682428922665; Tue, 25 Apr 2023 06:22:02 -0700 (PDT) MIME-Version: 1.0 References: <67b1e9b0-b7c6-71d4-cad2-2286edab759b@daniil.it> <2F21E8B8-190F-4E46-B42C-5EB490EE2AF7@gmail.com> In-Reply-To: <2F21E8B8-190F-4E46-B42C-5EB490EE2AF7@gmail.com> Date: Tue, 25 Apr 2023 15:21:51 +0200 Message-ID: To: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Final anonymous classes From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi Claude > > Hi all, > > > > I've submitted https://github.com/php/php-src/pull/11126 to add support= for final anonymous classes, though as noted by iluuu1994, it would probab= ly make more sense to just make all anonymous classes final by default, wha= t do you think? > > Extending an anonymous class is indeed possible (https://3v4l.org/pDFTL),= but it is a hack as best. If someone wants a non-final class, could they n= ot write a non-anonymous one? As a bonus, they wouldn=E2=80=99t need to ins= tantiate 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