Re: [RFC] Asymmetric visibility

From: Date: Sun, 07 Aug 2022 10:54:12 +0000
Subject: Re: [RFC] Asymmetric visibility
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-118363@lists.php.net to get a copy of this message
On Sun, Aug 7, 2022 at 12:34 PM Rowan Tommins <rowan.collins@gmail.com> wrote: > Can you expand on where you think the ambiguity / implicitness is? As I > understand it, the RFC is proposing exactly three new combined access > levels: > > - "public private(set)" > - "public protected(set)" > - "protected private(set)" > > Although aesthetically it will take a bit of getting used to, it seems to > me pretty clear that the first means "mostly public, but private if you > want to set it", and so on. > > The only thing I can think of that could be described as "implicit" is > that accessing a property by reference is considered a "set" operation, > which I'm not sure how any implementation could avoid. Personally for me it's the syntax. Reading "public private", "public protected", or "protected private" reads really weird `public private(set) static self $property`. In the end it makes sense if you know what it means, otherwise it's probably confusing. I really like this RFC and I feel like this might just be the way to go forward, but I have my doubts about how many more keywords can be realistically added before it becomes a problem.

« previous php.internals (#118363) next »