Re: [RFC] Reflection for references

From: Date: Tue, 15 Jan 2019 10:48:51 +0000
Subject: Re: [RFC] Reflection for references
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-103740@lists.php.net to get a copy of this message
Thank you Nikita, I will definitely need that RFC! Answering to Marco: * ReflectionReference seems to be designed around arrays only: maybe > ReflectionArrayKeyReference or such? > I agree with the wording in the RFC: the array is the primitive data structure in PHP that holds references. ALL other data structures can be turned to arrays. That includes objects with (array) and scopes with get_defined_vars(). Adding eg support for objects directly would open several questions, like: what about magic methods?, etc. So to me, we really need the simplest yet most powerful primite, and here it is, anything else can be built on top. > * Can the getId() return type be restricted to either > int or string? > A string would be enough I suppose, but I'll let Nikita anwer :) > * what are possible scenarios for getting the identifier as a primitive, > Indexing. Eg VarCloner needs an index of already discovered references to do its job. > * There seems to be a lot of design around > ReflectionReference#getId() > to avoid leaking internal pointer information: can it be completely > dropped, if we have $ref1->matches($ref2) instead? > Nope, see previous answer. As such, I think matches() would be added complexity for core with no extra benefit/power for users. In short, I really like the RFC as is :) (I removed your other comments Marco because I don't have anything special to say on them) Cheers, Nicolas

« previous php.internals (#103740) next »