Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91250 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63684 invoked from network); 17 Feb 2016 15:36:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2016 15:36:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=markus@fischer.name; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=markus@fischer.name; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fischer.name from 62.179.121.158 cause and error) X-PHP-List-Original-Sender: markus@fischer.name X-Host-Fingerprint: 62.179.121.158 vie01a-dmta-pe02-2.mx.upcmail.net Received: from [62.179.121.158] ([62.179.121.158:36623] helo=vie01a-dmta-pe02-2.mx.upcmail.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/8A-17120-99394C65 for ; Wed, 17 Feb 2016 10:36:58 -0500 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.72) (envelope-from ) id 1aW49t-0007oA-0J for internals@lists.php.net; Wed, 17 Feb 2016 16:36:53 +0100 Received: from mail02.home ([213.47.8.56]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id KTcr1s00Z1CY7x901TcsxY; Wed, 17 Feb 2016 16:36:52 +0100 X-SourceIP: 213.47.8.56 Received: from mail02.home ([192.168.1.14] helo=[IPv6:::1]) by mail02.home with esmtp (Exim 4.72) (envelope-from ) id 1aW49q-000613-PM for internals@lists.php.net; Wed, 17 Feb 2016 16:36:51 +0100 To: internals@lists.php.net References: X-Enigmail-Draft-Status: N1110 Message-ID: <56C49392.2070904@fischer.name> Date: Wed, 17 Feb 2016 16:36:50 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam_report: Spam detection software, running on the system "scanner01.home", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hello, On 17.02.16 15:25, Kevin Gessner wrote: > I've noticed s pattern in Etsy's code and elsewhere, where a trait provides > a common implementation of an interface. Classes that use the trait are > required to also explicitly declare the interface to benefit. I propose > that traits be permitted to declare and implement interfaces. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: Re: [PHP-DEV] [RFC] Traits with interfaces From: markus@fischer.name (Markus Fischer) Hello, On 17.02.16 15:25, Kevin Gessner wrote: > I've noticed s pattern in Etsy's code and elsewhere, where a trait provides > a common implementation of an interface. Classes that use the trait are > required to also explicitly declare the interface to benefit. I propose > that traits be permitted to declare and implement interfaces. I like this, because this is a pattern I experienced myself. In my code I've: - interface GroupBulkFilterable { .. } - trait GroupBulkFilterTrait { .. } and later class AbstractModelBridge implements ModelBridge, GroupBulkFilterable { use GroupBulkFilterTrait; Would use the interface on the trait in an instant. > Classes that > use such a trait would then implement the interface, as though it were > declared on the class, without declaring the interface explicitly. I don't like this. I prefer explicit over implicit. I would still see value in the first point only (but haven't thought that through ...). cheers, - Markus