Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118393 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 46095 invoked from network); 9 Aug 2022 02:20:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Aug 2022 02:20:37 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6889F18037F for ; Mon, 8 Aug 2022 21:22:02 -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,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS30496 206.123.115.0/24 X-Spam-Virus: No X-Envelope-From: Received: from mail1.25mail.st (mail1.25mail.st [206.123.115.54]) (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 ; Mon, 8 Aug 2022 21:22:01 -0700 (PDT) Received: from smtpclient.apple (unknown [49.48.242.109]) by mail1.25mail.st (Postfix) with ESMTPSA id 9E7B460342; Tue, 9 Aug 2022 04:21:53 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) In-Reply-To: Date: Tue, 9 Aug 2022 11:21:49 +0700 Cc: internals , Rowan Tommins Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Larry Garfield X-Mailer: Apple Mail (2.3696.120.41.1.1) Subject: Re: [PHP-DEV] [RFC] Asymmetric visibility From: php-lists@koalephant.com (Stephen Reay) > On 8 Aug 2022, at 20:21, Rowan Tommins = wrote: >=20 > On 08/08/2022 10:09, Stephen Reay wrote: >> The RFC states that it=E2=80=99s to keep consistency with `readonly`, = because __set on a readonly property that=E2=80=99s initialised throws = an error - but isn=E2=80=99t that because of the nature of it being = readonly, rather than because of the visibility rules? The error given = is "Cannot modify readonly property=E2=80=9D thrown from within the = __set() method, not "Cannot access protected property=E2=80=9D thrown = from the outside calling context, when the __set() method is not = implemented. >=20 >=20 > If a property is "public readonly", the __set method is never called = if you try to reassign it: https://3v4l.org/8PioE The proposal is that = the same applies if it is "public private(set)": the assignment = immediately fails, rather than falling back to the __set method. >=20 > The logic, I think, is that a completely private property is = "invisible", so __set acts like it doesn't exist at all and runs = *instead of* the assignment; but a "public readonly" or "public = private(set)" property is "visible", so the assignment is attempted and = fails. >=20 > However, I am concerned that the rules around where __set and __get = are called are becoming increasingly complex with a lot of different = concepts interacting - "declared", "defined", "typed", "initialized", = "visible", "modifiable", etc. >=20 > As I mentioned in a previous discussion, I think we need to work = towards simplifying this - e.g. merge "typed" and "untyped" properties = by making "public $foo" equivalent to "public mixed $foo", which would = remove the distinction between "defined" and "initialized". >=20 > Regards, >=20 > --=20 > Rowan Tommins > [IMSoP] >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >=20 Hi Rowan, Thanks for trying to explain the logic here. @Larry is Rowan=E2=80=99s assessment accurate? Cheers Stephen=20=