Hey Larry, hey Ilija

Am 29.05.24 um 21:15 schrieb Larry Garfield:
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*

In general I do like the RFC. No need for a flame retardand suit IMO ;-)

There is only one thing that I stumbled upon which struck me as odd:

> The set visibility, if specified explicitly, MUST be equal to or
> lesser than the main (get) visibility. That is, protected public(set)
> string $foo is not allowed.

Why?

Why can we not set a property as publicly writable but unreadable?

If that is a technical necessity, then so be it. But if that is a logical limitation, then I'm asking myself: why do we want to explicitly limit possible usecases? Not that I have one right now in my mind but I do know that we used similar settings in Filesystems for letterbox systems where users could copy files into other users letterbox (write only) without being able to later see the files.

Similar possibilities are available here here a property could be publicly writeable but only privately readable as read-access is only granted via a method.

I'm not saying it's the usualy use-case, but why explicitly disallowing it?

Cheers

Andreas

--
                                                              ,,,
                                                             (o o)
+---------------------------------------------------------ooO-(_)-Ooo-+
| Andreas Heigl                                                       |
| mailto:andr...@heigl.org                  N 50°22'59.5" E 08°23'58" |
| https://andreas.heigl.org                                           |
+---------------------------------------------------------------------+
| https://hei.gl/appointmentwithandreas                               |
+---------------------------------------------------------------------+
| GPG-Key: https://hei.gl/keyandreasheiglorg                          |
+---------------------------------------------------------------------+

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to