Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55906 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65159 invoked from network); 22 Oct 2011 18:27:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Oct 2011 18:27:50 -0000 Authentication-Results: pb1.pair.com header.from=jbondc@openmv.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jbondc@openmv.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain openmv.com from 64.15.152.204 cause and error) X-PHP-List-Original-Sender: jbondc@openmv.com X-Host-Fingerprint: 64.15.152.204 mail.ca.gdesolutions.com Received: from [64.15.152.204] ([64.15.152.204:58508] helo=mail.ca.gdesolutions.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/00-64758-22B03AE4 for ; Sat, 22 Oct 2011 14:27:49 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id 5745A5D5C; Sat, 22 Oct 2011 14:27:44 -0400 (EDT) X-Virus-Scanned: amavisd-new at gdesolutions.com Received: from mail.ca.gdesolutions.com ([127.0.0.1]) by localhost (mail.ca.gdesolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JuAlnfkPs2E3; Sat, 22 Oct 2011 14:27:43 -0400 (EDT) Received: from djbondc (modemcable166.116-70-69.static.videotron.ca [69.70.116.166]) by mail.ca.gdesolutions.com (Postfix) with ESMTPSA id 4032F5D16; Sat, 22 Oct 2011 14:27:43 -0400 (EDT) To: "'Anthony Ferrara'" , "'Nathan Nobbe'" Cc: References: In-Reply-To: Date: Sat, 22 Oct 2011 14:27:42 -0400 Message-ID: <003e01cc90e8$49dbdd60$dd939820$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcyQxp9zQd176JCoSEmSeEDr/jO3kwAHg6HA Content-Language: en-ca Subject: RE: [PHP-DEV] Revisit: Traits requiring composing class to implement interface From: jbondc@openmv.com ("Jonathan Bond-Caron") On Sat Oct 22 10:25 AM, Anthony Ferrara wrote: > Well, I have a few opinions on this that I think are worth sharing: >=20 > 1. If this change is made, we no longer would have mixins, but would=20 > have regular multiple-inheritance (With all the "issues" associated=20 > with it). Note that I said mixins and not traits. That's because=20 > since these were implemented with state (member properties), they are=20 > not traits as implemented, but regular mixins. (Yet another gripe, but = > that's slightly off topic). >=20 I think you misunderstand the difference between traits and mixins: http://code.google.com/p/es-lab/wiki/Traits Scala has mixins, php has traits. In short, the composition order does not matter with a trait (because = there are conflict resolution rules). With a mixin, the conflict resolution rule is the order of declaration. = class foo mixwith bar1, bar2 {} // bar2 wins=20 Though traits were originally defined as 'stateless', it doesn't make = them 'mixins' because they have state: http://bergel.eu/download/papers/Berg07e-StatefulTraits.pdf Javascript is probably the best example of 'mixins': myobject.mixin(bar1,bar2, {otherMethod: function(){} })