Hi Larry,

Thanks for the response.

> On Jun 9, 2021, at 12:51 PM, Larry Garfield <la...@garfieldtech.com> wrote:
> 
> Pierre and Mike:
> 
> "Asymmetric visibility" as we keep referring to it would mean the "implicit 
> accessors only" version of this: https://wiki.php.net/rfc/property_accessors
> 
> That is, it would let you define public/private/protected for get and set 
> operations on a property separately from each other.
> 
> There are three key differences between readonly and asymmetric visibility as 
> described there:
> 
> * Asymmetric visibility would allow a property to be reassigned multiple 
> times from within a class, readonly would allow writing to it only once when 
> it's uninitialized.  Whether one of those is too-tight or too-loose is a 
> matter of opinion and context.

When I read your statement I first thought you were wrong, but then I re-read 
Nikitia's RFC[1] and realized that RFC stated the properties of an object 
assigned to a readonly property *could* be updated, but *not* the readonly 
property itself.

I wonder if I was the only one who read that mistakenly?

Anyway, have either you or Nikita considered making a distinction between 
'public readonly' and 'private readonly' such that one could disallow any 
changes after initialization and the other could allow changes but only within 
the class?

-Mike
[1] https://wiki.php.net/rfc/readonly_properties_v2#proposal
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to