Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81505 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77973 invoked from network); 1 Feb 2015 00:15:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Feb 2015 00:15: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.172 as permitted sender) X-PHP-List-Original-Sender: ua.san.alex@gmail.com X-Host-Fingerprint: 209.85.213.172 mail-ig0-f172.google.com Received: from [209.85.213.172] ([209.85.213.172:50648] helo=mail-ig0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/71-01632-9107DC45 for ; Sat, 31 Jan 2015 19:15:21 -0500 Received: by mail-ig0-f172.google.com with SMTP id l13so11038960iga.5 for ; Sat, 31 Jan 2015 16:15:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=L4zWV2eO3nn6CrnjAcmpfBEylpR+eZ2NZhyp0irh//s=; b=yDbsiIpHHrRWtbetdamh99EGjdUIn5sa0RC53nA+MMsvWExA4M4EpKC5tXl6htHyPU mwXCYO1Ae81QJtTxCaroNOvLjJb+/FG10onCSa9eZHvg/y/sWji8T84fhy3fv+UeZ2ep /fvyLKzJWvRGysw5YDRxLXZwy4zaNRpfRLi81CLCL1VGBvjCc9Jfa0s6EdNLp9L9b7W8 JXhZmGPApsxNxcFUz0xrEMC17zWQTKxXjbxfZcuHjcUFFtsrCuUEfRcoThRtDav5wRiS zSoE87vI5GW8Oh3bp5CLDvFmAlWSRuy+qkHwD3a8zbXITUX5zOOJNXHkyfqSKhZazDBO jX5A== MIME-Version: 1.0 X-Received: by 10.50.142.106 with SMTP id rv10mr4563464igb.18.1422749718681; Sat, 31 Jan 2015 16:15:18 -0800 (PST) Received: by 10.50.93.3 with HTTP; Sat, 31 Jan 2015 16:15:18 -0800 (PST) In-Reply-To: <54CD6AD6.9080209@gmail.com> References: <54CD6AD6.9080209@gmail.com> Date: Sun, 1 Feb 2015 02:15:18 +0200 Message-ID: To: Stanislav Malyshev Cc: internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Use "caller" keyword, to access object caller. From: ua.san.alex@gmail.com ("S.A.N") 2015-02-01 1:52 GMT+02:00 Stanislav Malyshev : > Hi! > >> 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. > > If the API behaves differently depending on who is calling it, or > requires some information from the caller, it should be passed > explicitly - as a parameter/method call/etc. - not hidden. Otherwise it > would lead to nasty surprises when the user of the API assumes caller > does not matter but the implementor assumes it does. > -- > Stas Malyshev > smalyshev@gmail.com This is a controversial statement. If the caller explicitly send the object as an argument, it worsens loose depending API. And agreed this code looks weird and not well thought-out: object->call($holder); ?> Opportunity to shoot yourself in the foot, will always, developers node.js it know. I know that this code can be arranged differently, but then you have to make it more difficult and not nice. But if have an easy way to get a pointer to the owner, in practice, is very convenient.