Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118996 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78968 invoked from network); 13 Nov 2022 21:51:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Nov 2022 21:51:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C3890180083 for ; Sun, 13 Nov 2022 13:51:25 -0800 (PST) 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.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) (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, 13 Nov 2022 13:51:22 -0800 (PST) Received: by mail-vs1-f51.google.com with SMTP id q127so9801601vsa.7 for ; Sun, 13 Nov 2022 13:51:22 -0800 (PST) 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:message-id:reply-to; bh=3VVhsvoKjLIl/xsUH/mYiqd8IP8vM52wAV9ea+JGuCc=; b=EnSL5F0J7LfQqNlx01aT0LLSFfMhX/29DJgJ2Ts2oPGJqIHJdxa5GEYukne2NAQHZx goEqtbKUjYHbiuu9JbxnvKBZnCKbT8UbSrDwE9vdN1JxPf19HfUFeN7Ae+11NO0I44hw cZ/V5y7oiML5Xt32kIo9UM3hK53tKN/D92zjD2uzOE+1W5/XVZcOE6m3TCSVpGBqfHEL afqpgeqJxf6O3Rm1MF7m1Oah1JfAcfddGkFhsXf3HyY+V3+U7GMuzykIAAq6U4jYErb5 yo5h0nMC1gVM/O8b+2tH02CccXn7UEDE/2KZX8BSSfLWQ8GLSE+HYPs5OoPb+0RBkaea 0Q4Q== 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:message-id :reply-to; bh=3VVhsvoKjLIl/xsUH/mYiqd8IP8vM52wAV9ea+JGuCc=; b=7CrWHNT/OBkliIRvahohMSkd1M3JH3/55fpNMjt7rd+MML8ONggUDCMOuwEZnVv3HV L6G6QrxTYReVgWk6qo/tEsERqFzbRyVlWfRe0tlFkxe5E0wJnjEPA0vLXCgqFVHp3/jH sypLi3A0ioSgZifnduNs4XunzkCJ+58erB6JdSUC7TWiD8+L47gxGu/8fTwtP1oCEupR zUZZfxLG9qvRJKSHqMDz4Pq4OtouwGSGzOEm+kxlkDTpeC12gzTEHEWjCJ6Rs37W/zWA eXJNE5y1eqgJ5p51KNBSkHPus/W8B0gyDE8RhX5wW39P8C/7PquPu5gMqgjWyz0UoISQ FLTw== X-Gm-Message-State: ANoB5pm6wkj9UhTy2B2b/LZ7GVi2edwch058qY5RqopZRjC8+OgnlOLw xq2c1EZK777cTFNckiXujZDnImEfGFKLZyMiIUX8oJHqbDQ= X-Google-Smtp-Source: AA0mqf4FJuKv5LEZLoc7WTIRg1+wUEPW4x+Jgliz7CxFqbWo/YgN/iWyws00b18SHenGFJvdnCh5xNQD197mkigaVp4= X-Received: by 2002:a67:f9d4:0:b0:3a7:d585:5015 with SMTP id c20-20020a67f9d4000000b003a7d5855015mr4455288vsq.62.1668376281565; Sun, 13 Nov 2022 13:51:21 -0800 (PST) MIME-Version: 1.0 References: <0854b030-c51c-4c1b-a7dd-22835a1e5da9@app.fastmail.com> In-Reply-To: <0854b030-c51c-4c1b-a7dd-22835a1e5da9@app.fastmail.com> Date: Sun, 13 Nov 2022 18:50:45 -0300 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="0000000000009d4c9305ed611fb0" Subject: Re: [PHP-DEV] [RFC] Asymmetric Visibility, with readonly From: deleugyn@gmail.com (Deleu) --0000000000009d4c9305ed611fb0 Content-Type: text/plain; charset="UTF-8" > > > 2. `readonly` is a "write once" flag that may be combined with asymmetric > visibility. If no set visibility is specified, `readoly` implies > `private(set)`, but a different set visibility may also be provided. > > These are both reasonable rules. However, it creates a conflict. > Specifically, in the following cases: > > public public(set) readonly string $foo > > protected protected(set) readonly string $foo > What if the implicit rule for `readonly` is changed into `protected(set)`? Let's run with this for a minute. 1- It's not truly a CODE breaking change. Right now if you have a `protected readonly` property, you're either calling the parent constructor or you're never making use of the variable, otherwise you're getting a Fatal Error. 2- It's a CONCEPTUAL breaking change. If you've declared a `protected readonly` property, you may expect anyone in the inheritance chain to be calling your constructor. A new PHP version will warn you to either change your property into `protected private(set) readonly` (Rector might be able to do this) or accept the new behavior. 3- The two logical design choices can be kept. To be honest, I think asymmetric visibility seems way over complex for very little benefit, so I'm a bit against the entire feature, but if we were to have them, it would really be nicer to not have crazy shenanigans involved. -- Marco Deleu --0000000000009d4c9305ed611fb0--