Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35712 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38843 invoked by uid 1010); 21 Feb 2008 23:28:46 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 38828 invoked from network); 21 Feb 2008 23:28:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2008 23:28:46 -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:52419] helo=serv6.servweb.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/2B-64513-E290EB74 for ; Thu, 21 Feb 2008 18:28:46 -0500 Received: from [192.168.0.25] (toolslave.net [85.88.12.247]) by serv6.servweb.de (Postfix) with ESMTP id 4E8DC5903B8; Fri, 22 Feb 2008 00:30:15 +0100 (CET) Message-ID: <47BE092F.50504@stefan-marr.de> Date: Fri, 22 Feb 2008 00:28:47 +0100 Reply-To: php@stefan-marr.de User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: jvlad Cc: internals@lists.php.net References: <47BD207C.2080905@chiaraquartet.net> <47BE014F.5020202@stefan-marr.de> <4E.B9.64513.1650EB74@pb1.pair.com> In-Reply-To: <4E.B9.64513.1650EB74@pb1.pair.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Redirected: By TestProxy Subject: Re: [PHP-DEV] Re: Trait aliasing syntax suggestions From: php@stefan-marr.de (Stefan Marr) Hi, jvlad schrieb: > Why would this create any problems? Say, you have class B that extends class > A and both do define one method and one property under the same names. Will > this create a problem? No. It's because there are rules that clearly > describe how it works (method and property will be overriden). Similar > approach may be applied to trait'ing classes. Why not? For example if you > have a property defined above trait'ing, it will be overriden by the trait > if it comes up with its own property with the same name (same goes for the > properties defined in the ancestor class). If trait defines a property, it > can be overriden by class if it introduce it below trait'ing statement. > On the other hand, if someone being a developer cares of potential > "conflict" (unwanted override), he/she may simply not define properties and > constants in the class that's intended to be trait'ed into another class. This contradicts the idea behind traits. Here all conflicts are handled explicitly. Overriding is not used between traits to provide greater power and allow the notion of flattening in the way it has been proposed. Your proposal is much like mixins. But mixins have limited composition power caused by this overriding. There are situations without a suitable linearization to get overlapping methods from to different mixins in the needed combination. The complete argumentation can be found here: http://www.iam.unibe.ch/~scg/Archive/Papers/Duca06bTOPLASTraits.pdf illustrating the cons of mixins and multiple inheritance. Kind Regards Stefan