Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81396 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60794 invoked from network); 30 Jan 2015 02:53:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jan 2015 02:53:22 -0000 Authentication-Results: pb1.pair.com header.from=ua.san.alex@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ua.san.alex@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.177 as permitted sender) X-PHP-List-Original-Sender: ua.san.alex@gmail.com X-Host-Fingerprint: 209.85.213.177 mail-ig0-f177.google.com Received: from [209.85.213.177] ([209.85.213.177:57797] helo=mail-ig0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2C/52-47940-222FAC45 for ; Thu, 29 Jan 2015 21:53:22 -0500 Received: by mail-ig0-f177.google.com with SMTP id z20so239817igj.4 for ; Thu, 29 Jan 2015 18:53:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=gBolCYF2pWNUaMb8ecPDVIDY+6lsn1dfYpVUTN2vObM=; b=tydR504zjvI0ZdRuP/qFNUGGRvRHyZa/9BfX4cqCDMgdALpUL+ECmqOmDQOBwSu9Z7 ru7vVcHTwnLZiUa8req7rlwVXPALIL4BsJYbgmBm48CPiYsO+Fs6UOBe0fwqW+78DPCN 2Yq+4L1/ZAlSvjSMYd2VayuK58cjnLW2v+K3/qRNJaGhOXs/nqORnSS/uI9T4FJXRaGo MqI6WJt1UQYhCvKLLnvSvVkYwj9GGg0qJtl7J+7x7deH9H0wJfo2pXZDbME+gFCgBrh5 Mld3LPpgCy2kj8uCc4sTABnXr61lkQCxWJveS+GoyWYnzlqDaAiBLqn57lLm6kmJLdnB 5arw== MIME-Version: 1.0 X-Received: by 10.43.111.66 with SMTP id en2mr4069261icc.6.1422586399579; Thu, 29 Jan 2015 18:53:19 -0800 (PST) Received: by 10.50.93.3 with HTTP; Thu, 29 Jan 2015 18:53:19 -0800 (PST) Date: Fri, 30 Jan 2015 04:53:19 +0200 Message-ID: To: internals Content-Type: multipart/alternative; boundary=bcaec5171c0102644d050dd5b53b Subject: [PHP-DEV] Use "caller" keyword, to access object caller. From: ua.san.alex@gmail.com ("S.A.N") --bcaec5171c0102644d050dd5b53b Content-Type: text/plain; charset=UTF-8 The reason for creating circular references, usually due to the need to bind objects. But this relationship can often be obtained from the context of the call. It will be very convenient to have a keyword that will return reference to an object, which caused this object. Sorry for my English, I'm not a native speaker. A simple example below shows the behavior that we need. object = new C; } } class B { public function __construct() { $this->object = new C; } } class C { public function getCaller() { return caller::class; } } $a = new A; $b = new B; $c = new C; $a->object->getCaller(); // return A $b->object->getCaller(); // return B $c->getCaller(); // Fatal Error - undefined caller context ?> Create a new keyword can cause problems with backward compatibility... Perhaps you can solve a problem to using an existing keyword? Thank you for any feedback. --bcaec5171c0102644d050dd5b53b--