Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81507 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86988 invoked from network); 1 Feb 2015 00:40:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Feb 2015 00:40:10 -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.223.178 as permitted sender) X-PHP-List-Original-Sender: ua.san.alex@gmail.com X-Host-Fingerprint: 209.85.223.178 mail-ie0-f178.google.com Received: from [209.85.223.178] ([209.85.223.178:44066] helo=mail-ie0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9F/63-01632-9E57DC45 for ; Sat, 31 Jan 2015 19:40:10 -0500 Received: by mail-ie0-f178.google.com with SMTP id rd18so1711177iec.9 for ; Sat, 31 Jan 2015 16:40:06 -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=VzLUySXbYPv2BRz0gyN1wED3LooHJoMZpAV2yaJC83Y=; b=awVwSRwHbK2jkvpRvlm45Di/DI5ZwnNDw5Dl3mxiE1ODSQbtK88AlNEED7zdncrJ2J nwCblCJbjMal0OxVgy6GL2bu4oK7+KONU51kY+crEOj9RgVp2RZjtgvb7Wwkc52D1xCz 7Wp0W1t3xhSwJePvcOcFyGz91FFwxZjI7mTIc2GjDRnyWf1IjNrOYOBmXeDMC5QnlbzF U4zq53EP8JlVDNNXhLL4TPCPAGn6U8UzEdwaayRP+YeIuSQseR/TitDhg5ekJf2PT6Xa PNiISZzgLMcdnKSrhgebFEQMlj9x+REPIoCmvebvi8SRgTOmibhOQwNMFXd607/o5FAm O7xQ== MIME-Version: 1.0 X-Received: by 10.50.137.99 with SMTP id qh3mr4555758igb.7.1422751206747; Sat, 31 Jan 2015 16:40:06 -0800 (PST) Received: by 10.50.93.3 with HTTP; Sat, 31 Jan 2015 16:40:06 -0800 (PST) In-Reply-To: <54CD7218.9080909@gmail.com> References: <54CD6AD6.9080209@gmail.com> <54CD7218.9080909@gmail.com> Date: Sun, 1 Feb 2015 02:40:06 +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 2:23 GMT+02:00 Stanislav Malyshev : > Hi! > >> 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: >> > >> $holder->object->call($holder); > > This code explicitly says "object->call() is using $holder". It is clear > and unambiguous. If you did it implicitly - i.e. wrote > $holder->object->call() and that used $holder under the hood in call() - > then you could have modified or even completely destroyed $holder under > the assumption that nobody depends on it, but in fact whatever is in > $holder->object, unknown to you, would depend on it and would break. > Such hidden dependencies are not a good design. > >> But if have an easy way to get a pointer to the owner, in practice, is >> very convenient. > > It may be convenient in short run, but I think in the long run creating > hidden dependencies would make code less robust so it is better not to > enable it as a best practice. > -- > Stas Malyshev > smalyshev@gmail.com Everything is relative, when there is an experience in a dynamic context (this) in JS, while unwieldy structure in PHP code look something old and not comfortable. I think, that purchased experience will be the use of safety culture dynamic runtime context, many developers it would be appreciated, to implement this PHP frameworks.