On Fri, 12 Jun 2020 at 05:32, Troy McCabe <troy.mcc...@gmail.com> wrote:

>
> > You do mention performance as a benefit, but it's not immediately
> obvious to me which use-cases are bottlenecked by class constant reflection.
>
> Enum implementations are the big case for this.
>


I've also used it in the past for generating exception messages, because
the base Exception class requires $code to be int, so given a value of
1011, I wanted to map back to a constant like "MyException::TYPE_FOO".

If the concern is that we will end up with too many of these as global
functions, might there be value in a "lightweight reflection" API, which
gave access to things like this without the full power or performance cost
of Reflection?

Regards,
-- 
Rowan Tommins
[IMSoP]

Reply via email to