On Tue, Jun 30, 2020 at 1:26 PM Dan Ackroyd <dan...@basereality.com> wrote:

> On Mon, 29 Jun 2020 at 10:42, André Rømcke <andre.rom...@gmail.com> wrote:
> >
> > I'd like to start discussion on a new RFC proposing a way to be able to
> > (optionally) specify property
> > write visibility, separate from read:
> >
> > https://wiki.php.net/rfc/property_write_visibility
> >
>
> From the RFC:
> "Attempting to pass a property value outside of allowed writable scope
> as a reference, results in an error."
>
> This part could probably do with having some details for it.
>
> Also, any implementation of that rule might need to be checked for
> performance issues.
>

I think it would be technically possible, by extending the existing
mechanism for references to typed properties. However, we definitely
shouldn't do this, because it goes against existing language semantics. You
can take a reference to a normal private property (i.e. private get,
private set), pass it outside the class and then modify it. It would be
inconsequent to assign stricter semantics to a weaker visibility
requirement (public get, private set).

Regards,
Nikita

Reply via email to