Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89793 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87026 invoked from network); 10 Dec 2015 15:26:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Dec 2015 15:26:06 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.49 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.49 mail-wm0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:33654] helo=mail-wm0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/72-05164-D8999665 for ; Thu, 10 Dec 2015 10:26:06 -0500 Received: by mail-wm0-f49.google.com with SMTP id c201so38470462wme.0 for ; Thu, 10 Dec 2015 07:26:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=2W8nocns3Q772pn439TZXSdjWfcLWBcRjc+pg4Yc9s4=; b=mC/bIvSccjgzbKD66jmpScUuu/Jn+LUIvkVgbTYpHv41f/oR3acXAzFSzxY8sqYIsK nw/uVyeOW95ZkwA9/caE4vHA6OUz6x+pez4Pg6eJewNNSNZKFT92DvAlDfO6p6RaTOxW xL/7VRa7jLCiMicqBxL13Lbh8GjLbX5VP/EN2olRMUvEoOwe5ZDBO5cbP0vFVGu54h/l pzR52DvzWFL+db76PdvlSoYdhAd2+tS/5Sz8eDdtWIEGAmpqbN7LKG9vYuNpyOPosFaM 0uLCVF5IStXH0N8Uy6ixX3EQhec9f/MClws+Y9vC92u1xOC5H6gb7tnVZgHV0JPZp6Ai BmTQ== X-Received: by 10.194.2.193 with SMTP id 1mr13911527wjw.26.1449761162294; Thu, 10 Dec 2015 07:26:02 -0800 (PST) Received: from [192.168.0.137] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id h67sm1290341wmf.17.2015.12.10.07.26.01 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 10 Dec 2015 07:26:01 -0800 (PST) To: internals@lists.php.net References: <348752699.466407212.1449572494594.JavaMail.root@zimbra71-e12.priv.proxad.net> Message-ID: <5669997C.5010501@gmail.com> Date: Thu, 10 Dec 2015 15:25:48 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Class Friendship in PHP From: rowan.collins@gmail.com (Rowan Collins) Bishop Bettini wrote on 10/12/2015 14:44: > On Thu, Dec 10, 2015 at 12:02 AM, Dustin Wheeler wrote: >> I don't know that I would use friendship >> as a means to make an entire package (namespace, in PHP's case) aware >> of a single object. > > I think it's the other way around: a single object declares its friendship > with an entire namespace. I guess the point is that if package visibility were also implemented, you could simply make the relevant methods public, and the class as a whole private to the namespace. Any public APIs could then be on a public class in the same namespace, e.g in the same way as having methods "public final function foo()" and "protected function do_foo()", you could have "public class Thing" referencing "private class InternalThing". The advantage of friend declarations seems to be precisely that they are *not* making a general declaration of scope, but marking very specific couplings. If a large number of classes need access to something marked private, it's clearly not really private. Regards, -- Rowan Collins [IMSoP]