Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35820 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68005 invoked by uid 1010); 27 Feb 2008 15:08:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 67990 invoked from network); 27 Feb 2008 15:08:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Feb 2008 15:08:08 -0000 Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 38.99.98.18 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 38.99.98.18 beast.bluga.net Linux 2.6 Received: from [38.99.98.18] ([38.99.98.18:36655] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A4/02-56439-6DC75C74 for ; Wed, 27 Feb 2008 10:08:07 -0500 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 3776CC0FE3C; Wed, 27 Feb 2008 08:08:04 -0700 (MST) Received: from [192.168.0.106] (CPE-76-84-4-101.neb.res.rr.com [76.84.4.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id AAEF6C0FE3A; Wed, 27 Feb 2008 08:08:03 -0700 (MST) Message-ID: <47C57CF4.2000704@chiaraquartet.net> Date: Wed, 27 Feb 2008 09:08:36 -0600 User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: Lukas Kahwe Smith CC: php@stefan-marr.de, 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> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [PHP-DEV] Re: How to build a real Trait thing without exclusion and renaming From: greg@chiaraquartet.net (Gregory Beaver) Lukas Kahwe Smith 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)? Hi, OK, since none of my suggestions are acceptable, let me put it this way: I am full -1 for traits if it introduces 2 new keywords. Find a solution that does not, and I will change my vote. Greg