Re: reference caller object
| From: | Paweł Stradomski | Date: | Sat, 19 Sep 2009 16:59:32 +0000 |
| Subject: | Re: reference caller object | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-45617@lists.php.net to get a copy of this message | ||
W liście Chris Trahey z dnia sobota 19 września 2009:
> I guess what I'm really getting at is another access modifier:
> private, protected, public...
> And now adding something like trusted.
> trusted function myMethod() callable trustedInterface {}
>
> In a case like this, caller would always be available, but not always
> type-checked.
Or maybe just add friend classes or, since we have namespaces, something akin
default (namespace-level) accessibility?
Personally I'd be against functions behaving differnetly when called from
different contexts, it just breaks encapsulation. Also, PHP model is not
message passing (as in eg. Erlang), we have just plain function/method calls.
Also, what would be the sender/caller when executed from non-method (eg top-
level script or plain function)?
--
Paweł Stradomski