Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35854 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9192 invoked by uid 1010); 28 Feb 2008 14:48:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 9177 invoked from network); 28 Feb 2008 14:48:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Feb 2008 14:48:50 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:57378] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 01/21-08995-1D9C6C74 for ; Thu, 28 Feb 2008 09:48:50 -0500 Received: from MBOERGER-ZRH (unknown [193.142.125.1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 359C011F4A3; Thu, 28 Feb 2008 15:48:46 +0100 (CET) Date: Thu, 28 Feb 2008 15:48:49 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1858802954.20080228154849@marcus-boerger.de> To: Lukas Kahwe Smith CC: Gregory Beaver , php@stefan-marr.de, internals Mailing List , Marcus Boerger In-Reply-To: <4AE8AABE-167C-4705-9EA8-3987121A96EE@pooteeweet.org> References: <47C317F4.2080301@stefan-marr.de> <47C3854B.1000303@chiaraquartet.net> <4AE8AABE-167C-4705-9EA8-3987121A96EE@pooteeweet.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Re: How to build a real Trait thing without exclusion and renaming From: helly@php.net (Marcus Boerger) Hello Lukas, you still cannot ignore basic inheritance or reuse rules. Protocols have to be respected -> E_FATAL, fix your code. marcus Wednesday, February 27, 2008, 1:49:58 PM, you wrote: > 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 Best regards, Marcus