Re: Proposal for a RFC
| From: | Nicolas Grekas | Date: | Sun, 05 May 2019 15:07:43 +0000 |
| Subject: | Re: Proposal for a RFC | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105597@lists.php.net to get a copy of this message | ||
Le sam. 4 mai 2019 à 18:37, Marco Pivetta <ocramius@gmail.com> a écrit :
> Hi Steven,
>
> As it currently stands, the array cast is the only operation capable of
> exposing object state without triggering any kind of access guards: it is
> very much required for anything that works with reflection and typed
> properties, and possibly the only operation in PHP that operates on state
> without some contraption intercepting its execution.
>
> It is also necessary to distinguish dynamic properties from declared object
> state.
>
> For comparison, all of the following have side-effects due to the
> complexity of the language:
>
> * isset()
> * unset()
> * property read
> * property write
> * ReflectionProperty#getValue()
> * ReflectionProperty#setValue()
>
> Overall, this is problematic, and introduces more magic that I'd gladly
> avoid, in an endpoint used to work around all the engine magic (the only
> stable one so far).
>
> From my end, this sounds like a bad idea, because it removes one of the
> very very few referentially transparent guarantees (if not the only one,
> when dealing with objects) from the language.
>
> Greets,
>
> Marco
>
I want to weight in with what Marco expressed. I have the very same
concerns and they are major ones for many use cases. Mine is VarDumper.
Please don't do this the way it is described.
Nicolas