Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91520 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74468 invoked from network); 6 Mar 2016 17:43:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Mar 2016 17:43:29 -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.46 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.46 mail-wm0-f46.google.com Received: from [74.125.82.46] ([74.125.82.46:37587] helo=mail-wm0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/F4-29316-F3C6CD65 for ; Sun, 06 Mar 2016 12:43:27 -0500 Received: by mail-wm0-f46.google.com with SMTP id p65so46197182wmp.0 for ; Sun, 06 Mar 2016 09:43:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:references:from:to:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=KDqJUJkR0hiijJRmG2rwoWBq8cVo+BIBpdM7sstx4B8=; b=UrrQRJ0JE7iwGeDFQl1CaeDbyWmlJLzM6d7tRdIgC7HOiy4eH48pO75+I+RyVmhvSB z5DJHVx0StOqKmIxswwnf9L/9ubx0KNGjG4MMYJsVFiKCaKwPSeOXsXmtjNN0IYK8OOZ Y6tgIiQB6s9/FPiAsesVsZ/D/k1voTeuAXPn6jKlu4Xlvsnhj0LGwUBUMaVJVDAYnkgF yvZx3xfP+bIF7ATuo1LT3y8aqq34lebotp+YeThFZ1wVavqiCt6NG2S/JwkZLKMztY50 KXRXRgpFeAtfJkd38JF3hlyKPBwOPESVRD99Dt1d6mVATpxhG2CnRL44leVhekZbXzAm dQHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:references:from:to:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=KDqJUJkR0hiijJRmG2rwoWBq8cVo+BIBpdM7sstx4B8=; b=X7aH66plAa8IfEbsNVwNxnpKEQK4YfU8b0rALehr4a69XJbDt+WtCSWMOlUKKlerIO qhXoFZ+5cgrfwBX+Yd0SVeXT8cmJPRj4+E1dg8dAyQhuPGZhGOSc8Ag0Sfp65qo14wEf 2Iurx8od/KN2bqB4FximLOJ31Q4GYFYomkrrGUFbeTEaeVmZv438ELCC+cSKk0/mANG9 QwmTm+F5gCQDthbm16n71HCuIxamHW4MTd55Zwxl6x61XmMwqY/R+YFzqvQC/S4TgyC5 4cgVzTjjAmxHXvs1sn0/iIdhReN3u+FE7h+ohEOp4wpVjyw1ldA7e7kw30/3ApeUn5uf rApw== X-Gm-Message-State: AD7BkJJRdFivh2tqZeEcVrK0wMLcYpthIiycGMeACGWiwj0yQVM4kyUDChlVOK1/iTEY0A== X-Received: by 10.28.128.83 with SMTP id b80mr4836372wmd.6.1457286204542; Sun, 06 Mar 2016 09:43:24 -0800 (PST) Received: from [192.168.1.189] ([2.27.88.132]) by smtp.googlemail.com with ESMTPSA id fv6sm13956711wjc.12.2016.03.06.09.43.23 for (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Mar 2016 09:43:23 -0800 (PST) References: <94.96.08749.188B8D65@pb1.pair.com> <56D95E18.9020007@gmail.com> To: "internals@lists.php.net" Message-ID: <56DC6C32.4070801@gmail.com> Date: Sun, 6 Mar 2016 17:43:14 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.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] Re: [RFC] Traits with interfaces From: rowan.collins@gmail.com (Rowan Collins) On 05/03/2016 23:15, Davey Shafik wrote: > You are mid-reading, none of the classes in my examples extend the > others, they are all just using the same trait in different ways. > > - Class a: use the trait with no aliases. Result: as expected > - Class b: use the trait with a simple alias, no visibility change. > Result: both methods Right, the reason I was looking at inheritance was this line: > ... and_will_ override inherited methods of the same name. I misunderstood that the rest of the examples were also about how inheritance behaved. > For the one you can't re-produce, it's class 'c', which is stand-alone > here: https://3v4l.org/K9o6Y Right, so this is actually consistent, because the resulting "stitched together" class looks like this: class C { public function bar() {} private function bat() {} } Whereas when the alias wasn't private, it looked liked this: class B { public function bar() {} public function bat() {} } You can actually change its visibility on one line and alias it on another: class e { use foo { bar as private; bar as bat; } } https://3v4l.org/80gKF Stitched togorther, that gives you: class e { private function bar() {} public function bat() {} } So the main confusion is that "bar as private bat" != "bar as private" + "bar as bat". :) Regards, -- Rowan Collins [IMSoP]