RE: [PHP-DEV] Use "caller" keyword, to access object caller.
> De : Larry Garfield [mailto:[email protected]]
>
> Having an object that behaves differently depending on an implicit
> relationship with where it happened to be called from is full of all
> kinds of impossible to debug magic. I don't even know how you'd unit
> test it. I can think of no use case where this wouldn't cause only
> problems.
The only use case I can think of is to enforce access restriction (an alternative to
'friend' classes), faster than using debug_backtrace(). But I would prefer really
implementing friend classes/namespaces.
@S.A.N: you can already determine the caller using debug_backtrace(). Slow and inconvenient, but it
works.
Regards
François
Thread (19 messages)