Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118690 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85470 invoked from network); 25 Sep 2022 17:57:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Sep 2022 17:57:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7F4E31804C4 for ; Sun, 25 Sep 2022 10:57:14 -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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,HTML_MESSAGE,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-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 ; Sun, 25 Sep 2022 10:57:14 -0700 (PDT) Received: by mail-ot1-f48.google.com with SMTP id br15-20020a056830390f00b0061c9d73b8bdso3187825otb.6 for ; Sun, 25 Sep 2022 10:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=EiNLl2T/HyPiK9XV4BEKtmMHAwZvcb8wYw5Eomgn+ug=; b=TsQBLTEtKOTI6NZ6D3mxvUu00XQQaSp9hq5fhHCIv/R4R1wEyygj+NBRpkbLtZPP8X KFA1Bemj9ZLEP9o/NiBmJCWl2gBUI1N95pxVjlu7T8kNp0929S8Me6H5EljI7ZkpBbXN b94y1EIdZ18IU7y0fBpjjSdWnGMlX1krokxjUcGeCNzUATZ5P8+EY4TDgW8dw7BzHdoQ +A11Tn9zHkMD17s+oANt5/GWI62Z5PdeRfnh3sfvVCPBkWNshXGslgjpmNM24HMkkN0f viHPiV3SFYIZPlEldBHVB78x/uOQva7+I/5rERrscBo30HMl4xz6Cfm+9tAX5XHu1mja 9z5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=EiNLl2T/HyPiK9XV4BEKtmMHAwZvcb8wYw5Eomgn+ug=; b=QMtUJBif9cuTvtbx+9usTgdiEhkHVUz28IHV5DbqVKALbcG6kbwg8++AesefU/BbSW 7stwfebEkGCj/5SmkguaCgV6VYrkqPzv43jNoUyfo4Sj1j9BSr1FD+Ic5VgU4+hk4Z61 AktNoGQzQNl/zj+WlCeAZmPo+a8B0v8YYCjZpbG0Lp/lUdgyR279OJxH4+uHRYcApmKm 8X8tUVSPbOHaJT1/vwBx9pUebfGQrooMbNU6hB2oNNgpKzsvOylYzCG0ty58e4GtQ17Y K8X1fNY4C8XLIavHLu0+LtulDMwq3Rhwk+tECRCHaEa9JDlwYaT9ASIin/ow09B3eWzX NFJQ== X-Gm-Message-State: ACrzQf3pJGqO+oLlZU5wT+3p39NQ8x6RsOZ2pbBjxnFcA9eR86cTTJvY F5cytBXocDwkRobPLuTYkvHVkPwWdpwnC2xDnlw= X-Google-Smtp-Source: AMsMyM6qIduyypO0m0Yf6SSIUv4n6LFy7ij+vOaAbzkn/Na1W3ws1VxNcK5DGMxxqiIjfpYyGX+ouLFxRTCbFLacJ5Y= X-Received: by 2002:a9d:4e8a:0:b0:65a:b48:f4ff with SMTP id v10-20020a9d4e8a000000b0065a0b48f4ffmr8582499otk.228.1664128633460; Sun, 25 Sep 2022 10:57:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 25 Sep 2022 19:57:01 +0200 Message-ID: To: Larry Garfield , Nicolas Grekas Cc: php internals Content-Type: multipart/alternative; boundary="0000000000000edcb405e9842477" Subject: Re: [PHP-DEV] Re: Issues with readonly classes From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --0000000000000edcb405e9842477 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, I remembered the same thing, and am similarly baffled. How did the RFC pass > if you can do something as simple as `public readonly stdClass $var;`? I > thought I followed the discussion on that RFC, but apparently I missed > something. I would have expected an example like above to block acceptanc= e > of the RFC. To be clear though, I'm mostly confused about what the > convincing argument about this was, or if it was something that everyone > else viewed as an uncontroversial aspect? > The readonly class RFC doesn't really bring anything new to the table, just complements the readonly property RFC. The latter RFC explicitly mentions that interior mutability of properties is not restricted in any way. In my opinion, this is a wise and pragmatic approach= , so that use-cases like the body stream of PSR-7 remain possible. Please note that the feature is called "readonly", not "immutable". What's your take about 8.2? As I demonstrated, readonly classes are broken > because of this propagation to child classes. Does that mean we should > remove this constraint from 8.2? What about reverting the feature and > considering it again for 8.3, after fixing it? I agree with Tim, and I also think that both reverting and making any last minute fundamental change is not a good idea, especially because people don't have a clear agreement about how inheritance should work. Readonly classes is an optional feature, so anyone who wants proxies to work can simply not add the readonly flag to their classes. Of course, it's a bit more tricky for library code, but package authors should be aware of this gotcha. Having that said, I'll try my best to fix the current shortcomings for PHP 7.3. broken. see thread I may be biased, but neither I would call the whole feature "broken". It works as intended for many regular use-cases. However, as you highlighted in the thread, there are some use-cases with which the interoperability of readonly classes is suboptimal, to say the least. This is because the RFC was designed with a conservative approach (e.g. static properties and inheritance by non-readonly classes are forbidden). This way, we'll be able to iteratively improve the feature, while we minimize the risk of introducing undesirable behavior which would be difficult to get rid of later. I know that there is a thin line between "conservative" and "incomplete", but I do hope that PHP 7.3 will be the first version where readonly properties become actually useful. Does anyone else recall this? M=C3=A1t=C3=A9, are Jordan and I just imagin= ing > things? It may be possible that the discussion extended to this question, but neither me (author of the previous readonly properties RFC), nor Nikita had intention to restrict the usage this way due to the reasons detailed in the first paragraph. Regards, M=C3=A1t=C3=A9 --0000000000000edcb405e9842477--