Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47892 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91617 invoked from network); 12 Apr 2010 14:11:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Apr 2010 14:11:59 -0000 Authentication-Results: pb1.pair.com header.from=jbondc@openmv.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jbondc@openmv.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain openmv.com from 64.15.152.204 cause and error) X-PHP-List-Original-Sender: jbondc@openmv.com X-Host-Fingerprint: 64.15.152.204 mail.ca.gdesolutions.com Received: from [64.15.152.204] ([64.15.152.204:61012] helo=mail.ca.gdesolutions.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/8D-11452-B2A23CB4 for ; Mon, 12 Apr 2010 10:11:57 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id A0CB95D1A; Mon, 12 Apr 2010 10:11:52 -0400 (EDT) X-Virus-Scanned: amavisd-new at gdesolutions.com Received: from mail.ca.gdesolutions.com ([127.0.0.1]) by localhost (mail.ca.gdesolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ToixeH0Q7tz8; Mon, 12 Apr 2010 10:11:52 -0400 (EDT) Received: from djbondc (modemcable083.208-56-74.mc.videotron.ca [74.56.208.83]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id 2C36C5D12; Mon, 12 Apr 2010 10:11:52 -0400 (EDT) To: "'Stefan Marr'" , "'Lukas Kahwe Smith'" Cc: "'Derick Rethans'" , "'PHP Developers Mailing List'" References: <03128BF8-9EAC-4BAC-AAFE-6D8AA21153DC@pooteeweet.org> <4DA7D942-6BF1-4A0F-AECF-3EB82900798D@stefan-marr.de> In-Reply-To: <4DA7D942-6BF1-4A0F-AECF-3EB82900798D@stefan-marr.de> Date: Mon, 12 Apr 2010 10:11:51 -0400 Message-ID: <003701cada4a$196d29a0$4c477ce0$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 thread-index: AcraIQNxVP66ijEoTIWvbthLzNeoPQAJ3mow Content-Language: en-ca Subject: RE: [PHP-DEV] Traits From: jbondc@openmv.com ("Jonathan Bond-Caron") On Mon Apr 12 05:16 AM, Stefan Marr wrote: > > On 12 Apr 2010, at 10:39, Lukas Kahwe Smith wrote: > > On 12.04.2010, at 10:34, Derick Rethans wrote: > >> Hi! > >> > But just as a quick response, without aliasing, there would be no way > to use a conflicting method from a trait. > On first sight, that is not a really good thing. Hi Stefan, is it possible to have renaming and aliasing? Some context, say we have: trait Something { function renameIssue() { $method = 'call'; $this->$method(); call_user_func(array($this, $method)); } function call () { echo "a"; } } class Foo { use Something { function call() as call2(); } } With renaming: $f = new Foo; $f->call2(); // a $f->renameIssue(); // call() method does not exist With aliasing: $f = new Foo; $f->call(); // a $f->call2(); // a $f->renameIssue(); // a While aliasing prevents the error, the syntax could re-use the 'clone' keyword: class Foo { use Something { function call() clone call2(); } } So we'd have both behaviors: class Foo { use Something { function call() as call2(); function call() clone call3(); } } We have call(), call2(), call3() class Foo { use Something { function call() as call2(); } } We have call2() Other than that, the traits proposal still feels incomplete compared to grafts since from Stefan's research: "the lack of state means that virtually all traits are incomplete" It's still a great step if the current proposal (methods only) gets committed.