Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35817 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28479 invoked by uid 1010); 27 Feb 2008 14:35:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 28464 invoked from network); 27 Feb 2008 14:35:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Feb 2008 14:35:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@stefan-marr.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@stefan-marr.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain stefan-marr.de from 82.96.83.42 cause and error) X-PHP-List-Original-Sender: php@stefan-marr.de X-Host-Fingerprint: 82.96.83.42 serv6.servweb.de Linux 2.4/2.6 Received: from [82.96.83.42] ([82.96.83.42:35693] helo=serv6.servweb.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6D/00-23608-0A475C74 for ; Wed, 27 Feb 2008 09:33:05 -0500 Received: from [172.16.16.90] (toolslave.net [85.88.12.247]) by serv6.servweb.de (Postfix) with ESMTP id 6B33E590028; Wed, 27 Feb 2008 15:33:02 +0100 (CET) Message-ID: <47C574A9.1050600@stefan-marr.de> Date: Wed, 27 Feb 2008 15:33:13 +0100 Reply-To: php@stefan-marr.de User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Lukas Kahwe Smith Cc: Gregory Beaver , internals Mailing List , Marcus Boerger References: <47C317F4.2080301@stefan-marr.de> <47C3854B.1000303@chiaraquartet.net> <4AE8AABE-167C-4705-9EA8-3987121A96EE@pooteeweet.org> In-Reply-To: <4AE8AABE-167C-4705-9EA8-3987121A96EE@pooteeweet.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Redirected: By TestProxy Subject: Re: [PHP-DEV] Re: How to build a real Trait thing without exclusion and renaming From: php@stefan-marr.de (Stefan Marr) Lukas Kahwe Smith schrieb: >> class Talker { >> use A, B, C, D { >> smallTalk = A::smallTalk; // this says that if B, C or D implement >> smallTalk, it is ignored >> talk = A::bigTalk; >> } >> } > > Well this is not just a different syntax, but an entirely different > approach. In Stefan's proposal one had to explicitly handle every > conflict manually. in your proposal you do not have to do this. I share this objection. Maybe a somewhat handier solution of my proposal would be the option to leave out the method name, but I'm not quite sure whether it is really readable: class Talker { use A, B, C, D { B::smallTalk instead A, C, D; //to be read like: use B::smallTalk // instead the implementations form A, C, D } } > BTW Stefan: Whats the syntax for when you want to override a trait > method with one inside the class definition? > > I guess one would use "self::" like so: > > class Talker { > use A, B { > B::smallTalk instead A::smallTalk; > self::bigTalk instead B::bigTalk, A::bigTalk; > A::bigTalk as talk; > } > > function smallTalk() { > } > } Hm, personally, I would leave this out. The notion is that class definitions will override trait methods in any case (even/especially if traits methods are conflicting). So it would be fine to have this one implicit. This would also avoid construction attempts like: A::bigTalk instead self::bigTalk, A::bigTalk; Kind Regards Stefan