Re: [RFC] Asymmetric Visibility, v2
| From: | Robert Landers | Date: | Fri, 31 May 2024 21:26:53 +0000 |
| Subject: | Re: [RFC] Asymmetric Visibility, v2 | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-123481@lists.php.net to get a copy of this message | ||
On Fri, May 31, 2024 at 9:13 PM Claude Pache <claude.pache@gmail.com> wrote:
>
>
>
> Le 31 mai 2024 à 18:08, Larry Garfield <larry@garfieldtech.com> a écrit :
>
> However, this also brings up another interesting issue: readonly properties (in 8.3) DO allow
> redeclaration, essentially adjusting the property scope (the class that declares it) to make the
> visibility check pass. That is, the definition of the class it is private to changes, which is
> different from how inheritance works elsewhere. When the parent writes to the same property, a
> special check is needed to verify the two properties are related. All that special casing
> effectively means that readonly in 8.4 wouldn't really be "write once +
> private(set)", but "write once + private(set) - final", which is... just kinda
> screwy. That means our options are:
>
> * A BC break on readonly (not allowing it to be overridden)
> * Make readonly an exception to the implicit final.
> * Just don't allow readonly with aviz after all.
>
>
> Another possible option is:
>
> * Make readonly be
protected(set) by default.
>
> That would weaken the originally intended semantics of readonly, but in a compatible and
> acceptable way?
>
> —Claude
>
>
I know this doesn't really contribute to the conversation ... but if I
could ever mash a +1 on a single email, this is the email I'd choose.
"Best elegant solution that happens to delete readonly without
deleting readonly" award.
Robert Landers
Software Engineer
Utrecht NL