Re: [RFC] Reflection for references
| From: | Stanislav Malyshev | Date: | Thu, 17 Jan 2019 05:48:20 +0000 |
| Subject: | Re: [RFC] Reflection for references | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103753@lists.php.net to get a copy of this message | ||
Hi!
> I'd like to propose the addition of a ReflectionReference class, as
> described in the following RFC:
> https://wiki.php.net/rfc/reference_reflection
Do I understand correctly that the main use case here is to know if two
variables (treating this term expansively) point, by reference, to the
same zval/location? If so, I'd probably prefer a function that gives
answer to exactly this question.
Currently proposed API sounds a bit weird to me - why it's only
constructed from array element? It looks like a strange limitation.
Additionally, I'm not sure I understand whether there's a case for
"knowing whether array element is a reference to something" without it
being the use case above (i.e. comparing two things). I have no idea
what VarCloner does so it would be useful to have some clarity there.
> The TL;DR is that some libraries need a way to detect references and
> determine whether two references are the same. They previously used an ugly
Is this the same case or two different cases? Also, why do they need to
do it - what they are doing with this information afterwards?
--
Stas Malyshev
smalyshev@gmail.com