Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91274 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66487 invoked from network); 18 Feb 2016 18:28:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2016 18:28:58 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.174 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.174 mail-yw0-f174.google.com Received: from [209.85.161.174] ([209.85.161.174:33729] helo=mail-yw0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F1/A0-62769-86D06C65 for ; Thu, 18 Feb 2016 13:28:57 -0500 Received: by mail-yw0-f174.google.com with SMTP id u200so47857453ywf.0 for ; Thu, 18 Feb 2016 10:28:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=QLQoAuLEAMpCJPOXx8VeOWBwIPLxdql4dvI1bd2gW+Q=; b=G6iGn+fC2egt/+U38CQzIGkg7UhS3TDPTyjS1Uii8ghfz9M0Y2/wkwx14lXSZnbycv KqhFZ6//AO+ETpGQ2wl0lzs+tOKRjJRJM8HlnfhdFtqlJRYCDvNyo39Xq/v0dMGjpMKK ep4xiCbVjarnvXxVaaXjqiRphZ/+SAAPIS8NxJRhYavmW3Ab1UqxUNpb0Etq0Pxlrang 4ElQhcubt802Bu4jYZ3WIspCTPCAZtC7hsA3HprpZrvtw26pIOljRTitJk22RJsZzN25 00oMKVJVG7KZKYdhpeaY5hpVWmyXvzWiE16f78BoVA4h0WdtedO4orJX6sZYoE100GK0 +bOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=QLQoAuLEAMpCJPOXx8VeOWBwIPLxdql4dvI1bd2gW+Q=; b=LEHTHfTFTnKmcPbwVjBG2MimHN4INOsBZOtauTmfBHnaNLO9mO6i6gBcE9pEGjuSzM obFDrIhy0kJVd2mCpybJYqXbTp/IAgu+kPZBH6pTBOqydOzObJeEXm9/HtJLEzH9V4fq 7F0fy2ohMGRtzYJg0cLP3ZStSjm69nRFfxGP8Z0OxRhsAHHyhdPFW64TEFipAb8z8WTF H7CMVo0WvoW8H+LntbSqkol7qYYbQIn7XJyfN0Jf0ONqFWJjtJJ02Tcjf/BXN7cJXwBq n3Yp09ojbmPjyWbuL3Bo3W+I5LL7ZnZJU/9Jj5E2NmY3X0EAldj09spU3C7OwZKco/Pb 7Xvg== X-Gm-Message-State: AG10YOQQtMDAR6iq0wg3Cl+UrDC8/yn0y9ewMkk8jiseC2y1B1PUOvnA6FQJNQSk7OuWw/jCcul8tcdbSatLhA== MIME-Version: 1.0 X-Received: by 10.129.148.2 with SMTP id l2mr4998920ywg.298.1455820134181; Thu, 18 Feb 2016 10:28:54 -0800 (PST) Received: by 10.129.148.70 with HTTP; Thu, 18 Feb 2016 10:28:54 -0800 (PST) In-Reply-To: References: Date: Thu, 18 Feb 2016 19:28:54 +0100 Message-ID: To: Kevin Gessner Cc: PHP internals Content-Type: multipart/alternative; boundary=94eb2c07b516f476b2052c0f89bc Subject: Re: [PHP-DEV] [RFC] Traits with interfaces From: nikita.ppv@gmail.com (Nikita Popov) --94eb2c07b516f476b2052c0f89bc Content-Type: text/plain; charset=UTF-8 On Wed, Feb 17, 2016 at 3:25 PM, Kevin Gessner wrote: > Hello internals team! I'd like to propose an RFC to allow traits to > implement interfaces. > > 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. 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 believe this small change would be a useful improvement to the OO > system. I've written a draft RFC, but I don't have karma to create the > wiki page for it. Could someone please grant wiki karma to my account, > kevingessner? > > I don't yet have an implementation, but I'll be starting on one once I've > posted the RFC. I look forward to your thoughts and feedback. > Without given an opinion on the RFC itself, this might be interesting for context: http://hhvm.com/blog/9581/trait-and-interface-requirements-in-hack HHVM already supports "trait Foo implements Iface" with the semantics that the interface is also implemented by the using class. Additionally HHVM supports a notion of "require implements Iface" which means that the using class must implement this interface. Nikita --94eb2c07b516f476b2052c0f89bc--