Re: [RFC] Asymmetric Visibility, v2

From: Date: Wed, 29 May 2024 19:53:41 +0000
Subject: Re: [RFC] Asymmetric Visibility, v2
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hello Larry,
just a quick thought.
Is there a reason why we cannot just make it "public private string
$x" instead of "public private(set) string $x"?
We would define that the second visibility specifier is for write.

The current proposal with "public private(set)" is less ambiguous, and
it is immediately obvious that this is something new, and not just
somebody accidentally added two modifiers.
At the same time, it feels a bit alien and cluttered.

Other options could be something like "public:private" or "public-private".

A consequence of such options would be that you always need to specify
the read visibility along with the write visibility.
But this seems ok to me.

This is not a final opinion, just a thought.

-- Andreas

On Wed, 29 May 2024 at 21:17, Larry Garfield <[email protected]> wrote:
>
> As promised, Ilija and I offer this revised version of asymmetric visibility.
>
> https://wiki.php.net/rfc/asymmetric-visibility-v2
>
> It's still essentially the same as last year's version, but with a few adjustments
> and changes:
>
> * readonly properties are now supported in a logical fashion.
> * We've brought back the abbreviated form, as public-read, something else set is the most
> common use case.
> * The section on magic methods has been greatly simplified.  The implementation itself
> hasn't changed, but the explanation is a lot less confusing now.
> * We've explained how aviz interacts with hooks (they don't, really) and with
> interface properties (in the obvious way), which didn't exist at the time of the last draft.
> * We've added a section with examples of how aviz is a concrete improvement, even in a
> world with readonly and hooks.
> * We've added a section discussing why the prefix-style syntax was chosen.
>
> *dons flame retardant suit*
>
> --
>   Larry Garfield
>   [email protected]


Thread (57 messages)

« previous php.internals (#123458) next »