Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35815 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61648 invoked by uid 1010); 27 Feb 2008 12:50:54 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 61633 invoked from network); 27 Feb 2008 12:50:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Feb 2008 12:50:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 85.10.196.195 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 85.10.196.195 serveforce1.backendmedia.com Linux 2.6 Received: from [85.10.196.195] ([85.10.196.195:57299] helo=serveforce1.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 78/AD-63317-DAC55C74 for ; Wed, 27 Feb 2008 07:50:53 -0500 Received: from guest-77-74-2-65.pwlan.abanet.ch (guest-77-74-2-65.pwlan.abanet.ch [77.74.2.65]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) by serveforce1.backendmedia.com (Postfix) with ESMTP id 7401E1224BBC; Wed, 27 Feb 2008 13:52:08 +0100 (CET) Cc: php@stefan-marr.de, internals Mailing List , Marcus Boerger Message-ID: <4AE8AABE-167C-4705-9EA8-3987121A96EE@pooteeweet.org> To: Gregory Beaver In-Reply-To: <47C3854B.1000303@chiaraquartet.net> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Date: Wed, 27 Feb 2008 13:49:58 +0100 References: <47C317F4.2080301@stefan-marr.de> <47C3854B.1000303@chiaraquartet.net> X-Mailer: Apple Mail (2.919.2) X-backendmedia-com-MailScanner-Information: Please contact the ISP for more information X-backendmedia-com-MailScanner: Found to be clean X-backendmedia-com-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=2.086, required 6, AWL -1.45, FH_HELO_EQ_D_D_D_D 0.50, HELO_DYNAMIC_IPADDR 2.94, RDNS_DYNAMIC 0.10) X-backendmedia-com-MailScanner-SpamScore: ss X-backendmedia-com-MailScanner-From: mls@pooteeweet.org X-Spam-Status: No Subject: Re: [PHP-DEV] Re: How to build a real Trait thing without exclusion and renaming From: mls@pooteeweet.org (Lukas Kahwe Smith) On 26.02.2008, at 04:19, Gregory Beaver wrote: > My only objection is that this introduces two new keywords, trait and > instead. In addition, this can get very awkward if multiple traits > (more than 2) implement the same method name. I would prefer a simple > recycling of the "=" sign for both use cases (I'd also accept = for > override, "as" for alias). > > 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. As trait's specifically wanted to get away from automatic conflict resolution when things overlap, I think that Stefan's proposal makes more sense. 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() { } } I also assume that we would mandate signature compatibility (which IMHO should only throw an E_STRICT and not a fatal like what we currently do for inheritance in PHP6)? regards, Lukas