On Sun, Aug 7, 2022 at 10:38 PM Rowan Tommins <rowan.coll...@gmail.com>
wrote:

> On 07/08/2022 11:54, Lynn wrote:
> > Reading "public private", "public protected", or "protected private"
> > reads really weird `public private(set) static self $property`.
>
>
> Interesting, it seems that you've unconsciously broken it up as "public
> private" followed by "(set)", rather than "public" followed by
> "private(set)". Perhaps it's because of the position of the parentheses,
> which do feel awkward to me at first glance. Would it read more
> naturally to you with different punctuation?
>
> public (private set) static self $property;
>
> Or:
>
> (public; private set) static self $property;
>
> Or:
>
> public private-set static self $property;
>

The more I think about it, the more I agree with Marco's point of view on
this. I don't think there's a way to add this functionality without it
looking confusing one way or another. Once I get to use php8+, I'll
probably end up using readonly for most code. I think the feature itself is
nice for the scenario where you want to have private or protected
mutability, but even this is a scenario I would avoid myself. I'm afraid
that based on the future possibilities `package(set)` will make it even
more confusing when allowing external modifications by specific classes,
which would make it even more complicated to find out who or what may or
may not modify a property from a reader perspective (like code reviews).

Reply via email to