Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91326 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55424 invoked from network); 19 Feb 2016 19:34:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2016 19:34:17 -0000 Authentication-Results: pb1.pair.com header.from=chasepeeler@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=chasepeeler@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.169 as permitted sender) X-PHP-List-Original-Sender: chasepeeler@gmail.com X-Host-Fingerprint: 209.85.214.169 mail-ob0-f169.google.com Received: from [209.85.214.169] ([209.85.214.169:33493] helo=mail-ob0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 74/51-36948-73E67C65 for ; Fri, 19 Feb 2016 14:34:15 -0500 Received: by mail-ob0-f169.google.com with SMTP id jq7so117567349obb.0 for ; Fri, 19 Feb 2016 11:34:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=y8c0Q8aM1msbzO3r5jxXUh7oPai54RzBMiBik2/iOjI=; b=i/ZVNHubjdSS98qj75a84UmDXXRjK1C7W14RXwf+lPQHIW1Mu46JjKUVRaO2Wh5IUR skh5jN4Q04Fh7zV/n/KH4GjftDlFtS6cG7sZj2VMSE6XoyV/Wslko6MNyBcKzF227svZ 7m97xp5bdKddQzx2sczHXxnBpzQjjx3egocb9aSD3HcfuOUURy6NR1Yj+lPG8KKhSb3/ 47wuU4ak2z13NKkkuQMxTXRAzhnaPlDlcVRRJwm+dBz9iQY6ffkJjOH8R2qP1d540Vfo s6pKNIc25EhasiQ5T0QNW2qnGWqQfCOJ5vv+6BdTXCpMYi96wwocjYPGm+rvEJ4FMLrx SG+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-type; bh=y8c0Q8aM1msbzO3r5jxXUh7oPai54RzBMiBik2/iOjI=; b=TDhUIjctb9N90CpYWMk1Gye8aN7b332PPUQL67zYaRzCVUpEnD/TumRD7KyUGrsF3r CQ5Ex2m/adlfQ270gn/szFtoDDKQ4p43aaGnR+BDNFFKyxd/idJUSSdzVSIMGki4c1zX FwDvM1I6hFA+5cJOYGMxXi+uNvZyBOekoKFDCHXJstzRM7xvfqaaRc9zkzYFlwCJhvBf TrJheO6rH5Be6zEbLRSlWWgNNtHD3Fxk/JXme3QSz5bacWoIBXzTxcucJPrBX8oC4IE6 ciKX3z8sRrtlhYPt76XX5HdXlH7iGkjYdE1jjxygzXYgmNuPXBb221Tq4CqnoBxTwrg1 gPag== X-Gm-Message-State: AG10YORcJd4yLrNIaSMOrH6uM3WJzmCzvVpXrWtFiPEuUtN0fBYnIlQhUvajNeXWo2T6AVt7ppxrQQ01FGyJgw== X-Received: by 10.60.162.102 with SMTP id xz6mr13487108oeb.62.1455910452680; Fri, 19 Feb 2016 11:34:12 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 19 Feb 2016 19:34:03 +0000 Message-ID: To: Kevin Gessner Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary=047d7b2e75fe5b5f98052c2491a2 Subject: Re: [PHP-DEV] [RFC] Traits with interfaces From: chasepeeler@gmail.com (Chase Peeler) --047d7b2e75fe5b5f98052c2491a2 Content-Type: text/plain; charset=UTF-8 On Fri, Feb 19, 2016 at 2:13 PM Kevin Gessner wrote: > On Thu, Feb 18, 2016 at 2:16 PM, Chase Peeler > wrote: > >> On Thu, Feb 18, 2016 at 1:29 PM Nikita Popov >> wrote: >> > 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. >>> >> > This was mentioned in the original traits RFC, but never got voted or > implemented: > https://wiki.php.net/rfc/horizontalreuse#requiring_composing_class_to_implement_interface > > It's orthogonal to this RFC. > > >> >>> Why should it matter if the class using the trait actually implements >> the interface? If the person just wants the functionality, but, for >> whatever reason, doesn't want to actually implement the interface, why >> should it matter? >> >> I think the trait should HELP the person implementing an interface. The >> trait should be able to say (whether via comments or an engine enforceable >> construct) "Hey, I've done everything needed for you to implement this >> interface" but, at no time, should the trait force the class utilizing it >> to interact (via extend or implement or use) a 3rd artifact. >> >> trait foo implements myinterface {} >> class bar { use foo;} >> class baz implements myinterface { use foo;} >> >> Both of the above should be legal, and $myBar instanceof myinterface >> should return false; >> > > This is Proposal 1 in the new draft of my RFC: > https://wiki.php.net/rfc/traits-with-interfaces > > Does that proposal sound like what you'd want? > > I don't really have any objections to proposal 1. Part of me would still like to see a different keyword used, but I don't think that's a huge deal. I think the important part is not propagating the implementation (proposal 2). My comments above, however, were more in relation to the HHVM notion of "requires implement interface" which I don't think either proposal does. > Cheers > -- Kevin > >> -- -- Chase chasepeeler@gmail.com --047d7b2e75fe5b5f98052c2491a2--