Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55912 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69968 invoked from network); 23 Oct 2011 23:28:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Oct 2011 23:28:40 -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 81.20.134.149 cause and error) X-PHP-List-Original-Sender: php@stefan-marr.de X-Host-Fingerprint: 81.20.134.149 vps-1012701-4512.united-hoster.de Received: from [81.20.134.149] ([81.20.134.149:56687] helo=vps-1012701-4512.united-hoster.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0F/70-63346-523A4AE4 for ; Sun, 23 Oct 2011 19:28:38 -0400 Received: from [12.232.236.2] (helo=[172.16.0.120]) by vps-1012701-4512.united-hoster.de with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1RI7Sx-0005mK-TW; Mon, 24 Oct 2011 01:28:34 +0200 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Sun, 23 Oct 2011 16:28:16 -0700 Cc: Nathan Nobbe , internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <7403D757-228F-4C59-BCE5-8731BEC5CA25@stefan-marr.de> References: To: Anthony Ferrara X-Mailer: Apple Mail (2.1084) Subject: Re: [PHP-DEV] Revisit: Traits requiring composing class to implement interface From: php@stefan-marr.de (Stefan Marr) Hi Anthony: I will not comment on the original question of this thread, but felt = obliged to point out some details where my understanding differs from = what I understand from your explanation.=20 On 22 Oct 2011, at 07:25, 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 > have regular multiple-inheritance (With all the "issues" associated > with it). Note that I said mixins and not traits. That's because > since these were implemented with state (member properties), they are > not traits as implemented, but regular mixins. (Yet another gripe, but > that's slightly off topic). Please refer to: = https://wiki.php.net/rfc/horizontalreuse#handling_of_propertiesstate "Traits do not provide any provisioning for handling state." What you observe is that PHP is a very dynamic language when it comes to = the definition of fields. And that is what traits also take into account. We do the minimal = possible thing, to keep the WTF factor low, but there is no "real" = support for state. And as someone else pointed out: the main difference is indeed the = difference between linear application (mixins) and order-less = composition (traits). > There's a much bigger problem though. How would you solve the problem > where a class uses a trait that implements an interface, but you don't > pull one of the methods through (for example, you exclude it in the > use clause)? The relevant part of the RFC: = https://wiki.php.net/rfc/horizontalreuse#conflict_resolution We abandoned the idea of an explicit exclude operator long ago. (I think = it was never in the PHP SVN.) Thus, the situation you describe cannot occur in the sense that a method = is missing from the class. However, you can of course provide incompatible method implementations. = (Which does not make traits any different from any other way to = implement an interface.)=20 Best regards Stefan --=20 Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525