Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91514 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25534 invoked from network); 6 Mar 2016 02:03:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Mar 2016 02:03:56 -0000 Authentication-Results: pb1.pair.com header.from=jesseschalken@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jesseschalken@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: jesseschalken@gmail.com X-Host-Fingerprint: 209.85.223.178 mail-io0-f178.google.com Received: from [209.85.223.178] ([209.85.223.178:33084] helo=mail-io0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/15-08669-A009BD65 for ; Sat, 05 Mar 2016 21:03:55 -0500 Received: by mail-io0-f178.google.com with SMTP id n190so99610707iof.0 for ; Sat, 05 Mar 2016 18:03:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=uojTBLhCI3cdJTSvFabeHVuU5Hx0tg5F5MibaeuW52o=; b=d+FAgmAmqwLdbx3HelC5XSVnuR/ORDxNsVkQ8E2TFnYboIN04EmQKWiHEFpOp2hLTA OG2gxPj73iR1kqotmlxOCz+4Ig0mXA+hIO3RrHB5mI+TEzjufdJz1mWwnktHUnaxJ70w +DqNqeB2AnBl3KwP9T5vyZcFW2NYQMne7jTRMJlWOYVJdkc7wNK2MZnvOqN2WOJjpk3v 9J6F8nIzjjDOlhsJoIHA1nF6JzuRj2qxbWNl8ipOuYRtbYjEgRlg3Db2eSq+IEjDs+oO UIgi2rgoD5y5U9scOpkeLpYisEixnVwTZ+Dcf+uwm1K1QrYT9gKhHar/xFGychyMmFk6 a13g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=uojTBLhCI3cdJTSvFabeHVuU5Hx0tg5F5MibaeuW52o=; b=gCgp0I8Tm+ofKqDTrVKYkataItlMH7oU8MO8eYSQW1AnuIN9V+3qCSaD9dDSYIvRtp S5QwhRLyQ//KGrORVG/Zj1lXnuchQMToCkNSgJ3L78oxj//fVWNslyug8nZ9tjOJm29Z iX3/wcdXfJiTLPhTzHW1t6nQWaCk1MfuxoLeuJXr48/h8L8QU4ji/I7tdXEeO9JYNhP1 c/FCeg6QibPHetdjRs4b06frUU1+G4srjqpAfD5u3lsGBYycJeiCwHsy+GiiBo7Akq1D SyMUQjHVervLcaLxPrlCe9QpHCh0KzWGqIn4qZkJaCm9aglNJ8j5AxGvM5zksxm6qarx Axgg== X-Gm-Message-State: AD7BkJL91vpLD28E2IIuBkAfogwaKBTOx1LsJshIO3t1AUeUeLad7XNy1wmqFcRFZMJ+13f4SkRjXrsuGBhMiQ== MIME-Version: 1.0 X-Received: by 10.107.158.20 with SMTP id h20mr14695369ioe.31.1457229832111; Sat, 05 Mar 2016 18:03:52 -0800 (PST) Sender: jesseschalken@gmail.com Received: by 10.79.100.199 with HTTP; Sat, 5 Mar 2016 18:03:51 -0800 (PST) Received: by 10.79.100.199 with HTTP; Sat, 5 Mar 2016 18:03:51 -0800 (PST) In-Reply-To: References: <94.96.08749.188B8D65@pb1.pair.com> <56D95E18.9020007@gmail.com> Date: Sun, 6 Mar 2016 13:03:51 +1100 X-Google-Sender-Auth: boknhXl7nUVXTxOl6M1HJy2W6Gg Message-ID: To: Davey Shafik Cc: "internals@lists.php.net" , Rowan Collins Content-Type: multipart/alternative; boundary=001a11402ad47fce4c052d57c2e7 Subject: Re: [PHP-DEV] Re: [RFC] Traits with interfaces From: me@jesseschalken.com (Jesse Schalken) --001a11402ad47fce4c052d57c2e7 Content-Type: text/plain; charset=UTF-8 Your class 'c' example (last link) only shows method 'bar' (the trait method) and not 'bat' (the aliased metod). The class has both, but 'bat' is hidden from get_class_methods() because it is private. On 6 Mar 2016 10:16 am, "Davey Shafik" wrote: > On Fri, Mar 4, 2016 at 2:06 AM, Rowan Collins > wrote: > > > Davey Shafik wrote on 04/03/2016 07:17: > > > >> 1. If you simply alias (use foo { bar as bat; }) then you end up with an > >> *additional* method with the new name, the trait method as defined is > >> still > >> brought in, and_will_ override inherited methods of the same name. > >> > > > > Here's a clearer example of this: https://3v4l.org/RKHPt > > > > Unfortunately, you can't even use "insteadof" to directly bring the > parent > > method back in [https://3v4l.org/qOS5T], but you can stub it out with a > > direct call to parent:: [https://3v4l.org/s9i4N]. > > > > 3. Doing this (visibility + name)_only_ gives you the new method, which > is > >> _different_ behavior to #1 > >> > > > > I can't reproduce this: if I say "bar as private bat", the trait's bar > > still shows up, and is public, just as in the previous example: > > https://3v4l.org/1jH6o > > > > Your examples are rather confusing because they are effectively applying > > the same trait twice, at different levels of the hierarchy; I'm not sure > > this is a particularly likely scenario, or relevant to how interfaces > > should behave. > > > > Regards, > > > Rowan, > > 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 > - Class c: use the trait with and alias both name, and change visibility. > Result: ONLY the aliased method > - Class d: use the trait and "alias" to the same name, ONLY changing > visibility. Result: causes a Fatal error, clashing with itself o.O > > For the one you can't re-produce, it's class 'c', which is stand-alone > here: https://3v4l.org/K9o6Y > > - Davey > --001a11402ad47fce4c052d57c2e7--