Re: reference caller object
| From: | troels knak-nielsen | Date: | Fri, 18 Sep 2009 14:12:55 +0000 |
| Subject: | Re: reference caller object | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-45602@lists.php.net to get a copy of this message | ||
On Fri, Sep 18, 2009 at 1:05 PM, Ford, Mike <M.Ford@leedsmet.ac.uk> wrote:
> Well, that sounds like a pretty good definition of a "magic" constant, so maybe
> __CALLER__ might be appropriate as well?
It's not a constant, is it now?
__FILE__, __LINE__, __CLASS__ etc. can be resolved at compile-time.
The caller will only be known at run time.
I, for one, am quite happy that it's fairly complicated and convoluted
to get the caller of a method, since it could lead to some seriously
incomprehensible code in the hands of someone who don't know what they
are doing. Requiring the user to use the backtrace is a clear warning
sign, and I think that's a good thing.
--
troels
On Fri, Sep 18, 2009 at 1:05 PM, Ford, Mike <M.Ford@leedsmet.ac.uk> wrote:
>> -----Original Message-----
>> From: Richard Quadling [mailto:rquadling@googlemail.com]
>> Sent: 18 September 2009 10:43
>
>>
>> Considering we have func_get_args(), maybe func_get_caller() would
>> be
>> a nice fit.
>>
>> I don't like the idea of a constant (CALLER) which changes value as
>> you move around the code. Quite obviously, it isn't constant!
>
> Well, that sounds like a pretty good definition of a "magic" constant, so maybe
> __CALLER__ might be appropriate as well?
>
> Cheers!
>
> Mike
> --
> Mike Ford,
> Electronic Information Developer, Libraries and Learning Innovation,
> Leeds Metropolitan University, C507, Civic Quarter Campus,
> Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
> Email: m.ford@leedsmet.ac.uk
> Tel: +44 113 812 4730
>
>
>
>
>
> To view the terms under which this email is distributed, please go to
> http://disclaimer.leedsmet.ac.uk/email.htm
>