# Property Overloading RFC

- Thread: https://externals.io/message/17522
- Original archive: https://news-web.php.net/php.internals/17522
- Started by boots on 2005-08-04T04:29:51+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #17522 — boots — 2005-08-04T04:29:51+00:00

URL: https://externals.io/message/17522#17522

Derick Rethans wrote:
> Problems:
> 1. There is no way to document the 'virtual' properties with any of 
>    the existing documentation tools (such as phpdoc and doxygen)
> 2. There is no way how the magic methods know if a specific 'virtual'
>    property exists or not as those properties are not declared
usually
>    - unless you define an array with property names as a class
>      constant (which is not allowed either).
> 3. There is no way for the magic methods to return a meaningfull 
>    error when a property doesn't "exist". Of course it is possible to
>    throw an error with "trigger_error" or "throw" in case a property 
>    doesn't "exist" in a specific class, but the file and line numbers

>    would not match the actually get/set action. `debug_backtrace()` can

>    be used to retrieve the correct file and line, but as you have to 
>    do this for every class where you want to use setters and getters 
>    *and* you have to implement your own error message rendering
>    function this is not really a suitable option either.

As far as introspection (points 1 and 2), would it be reasonable to
allow __get/__set to be called without any parameters in which case
they would be expected to optionally return an array or object
designating the properties that they support? I know that this is
somewhat magical but dynamic features are somewhat magical to begin
with -- which is part of their charm.

FWIW, it would be nice if there was a way for __get/__set to support
references.

Greetings.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

---

## #17543 — Marcus Boerger — 2005-08-04T18:04:12+00:00

URL: https://externals.io/message/17522#17543 · In reply to: #17522

Hello boots,

Thursday, August 4, 2005, 6:29:51 AM, you wrote:

> Derick Rethans wrote:
> > […]
> usually
> > […]

> > […]

> > […]

> As far as introspection (points 1 and 2), would it be reasonable to
> allow __get/__set to be called without any parameters in which case
> they would be expected to optionally return an array or object
> designating the properties that they support? I know that this is
> somewhat magical but dynamic features are somewhat magical to begin
> with -- which is part of their charm.

To complicated and uses one thing to do two completley different things
which confuses everyone.

> FWIW, it would be nice if there was a way for __get/__set to support
> references.

Best regards,
 Marcus
