Re: [RFC] Asymmetric Visibility, with readonly

From: Date: Wed, 30 Nov 2022 14:56:56 +0000
Subject: Re: [RFC] Asymmetric Visibility, with readonly
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-119060@lists.php.net to get a copy of this message
On Wed, Nov 30, 2022, at 4:02 AM, Claude Pache wrote: >> Le 30 nov. 2022 à 02:27, Larry Garfield <larry@garfieldtech.com> a écrit : >> >> On Tue, Nov 29, 2022, at 5:46 PM, Claude Pache wrote: >> >>> In the RFC, section Permitted visibility >>> (https://wiki.php.net/rfc/asymmetric-visibility#permitted_visibility >>> >>> <https://wiki.php.net/rfc/asymmetric-visibility#permitted_visibility>): >>>> The set visibility, if it differs from the main (get) visibility, MUST be strictly >>>> lesser than the main visibility. That is, the set visibility may only be protected or private. If >>>> the main visibility is protected, set visibility may only be private. Any violation of this rule >>>> will result in a compile time error. >>>> >>> The first sentence does not forbid public public(set), >>> or `protected >>> protected(set), etc. (the set` visibility does not >>> differ from the >>> main visibility), but the rest of the paragraph does not allow it. That >>> should be clarified. >> >> Er. That's exactly what it says: "strictly lesser" than the main >> visibility. The lines after are just restating it. "public public(set)" is not allowed. > > As I understand the first sentence (what it says, not what you meant): > > “The set visibility, **if it differs from the main (get) visibility**, > {$some_restriction}.” > > In public public(set), the set visibility does not differ from > the > main/get visibility, therefore {$some_restriction} does not apply. > > My guess is that you wanted to say: > > “The set visibility, **if specified explicitly**, {$some_restriction}.” Ahhh... I see what you're getting at. Fair point, I'll adjust it. Thanks. --Larry Garfield

« previous php.internals (#119060) next »