Re: [RFC] Asymmetric Visibility, with readonly

From: Date: Tue, 29 Nov 2022 23:46:51 +0000
Subject: Re: [RFC] Asymmetric Visibility, with readonly
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-119053@lists.php.net to get a copy of this message
> Le 29 nov. 2022 à 21:29, Larry Garfield <larry@garfieldtech.com> a écrit : > > > Thank you everyone for the feedback. Based on this thread, we've made two changes to the > RFC: > > 1. We've moved readonly back to forbidden with a-viz for now. I've added a section > to Future Scope where we really should sort this out in the future, but we'll do that in the > future when we can all focus on the various nuances of just that piece. > > 2. I rewrote the section on __set to make it clearer. That also included Ilija and I digging > into all the nuances that are already present. The text may still look a bit complex, but > that's because the existing logic is already complex with readonly. Long story short, the > a-viz RFC does not change anything in the way __set works vis a vis asymmetric visibility; it just > inherits and continues what readonly already started, so it's consistent. > > The PR should be updated in the next week or two with the latest changes. Baring any major > need for change, we expect to call a vote for it shortly after New Years. > > Thanks all. > > --Larry Garfield > Hi, 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. (Because forbidding public public(set), etc., makes it slightly more cumbersome to explain the rules, I am slightly in favour not to forbid it.) > There is one exception, that of a private readonly property. That would technically expand to > private private(set) readonly, which is allowed. That sentence should be deleted, as readonly is now forbidden. —Claude

« previous php.internals (#119053) next »