Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91271 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59251 invoked from network); 18 Feb 2016 17:48:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2016 17:48:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=kgessner@etsy.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kgessner@etsy.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain etsy.com designates 209.85.192.44 as permitted sender) X-PHP-List-Original-Sender: kgessner@etsy.com X-Host-Fingerprint: 209.85.192.44 mail-qg0-f44.google.com Received: from [209.85.192.44] ([209.85.192.44:36721] helo=mail-qg0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/C3-32469-8F306C65 for ; Thu, 18 Feb 2016 12:48:40 -0500 Received: by mail-qg0-f44.google.com with SMTP id y9so43184046qgd.3 for ; Thu, 18 Feb 2016 09:48:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=etsy.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=4coJZ6jwPcs6NZqBECYFLuQbt5QOW5LWzdrqkkH0RY0=; b=eUIMUwqFm16ZIwvUTAPNXXNVyFWoKTagX1qzSdKWKUynovzaC4zfO/y3yklBfSC8ya m4FlSJDxohi9qnNbXfLTr7Lr0aEoN1mNybfZtTpMcfYKTdSlcTX8jsXYeTtg2fyYENT8 01/iSOjs+bC21AQ84QCr5VSOCuRkqSPZ6gk1g= 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=4coJZ6jwPcs6NZqBECYFLuQbt5QOW5LWzdrqkkH0RY0=; b=MCT6Iit+EXYru1DX7URmBFl6fDcHzEbCmsveDmoHyeH275bUvU4//gPPhRiQsZFfBu ywtRlorPTFbJxV2q1lvgKHH8hkNWJ/gBV2Pj5GqrdmoU1QlKeiruMRXhFXEd3sNXbvAL 7ARHtyLtfAoPWpTcqTqFjkCghek9mKKUVM1ZZZqudLuC5IY4/oHRVDIFyKUvCKlvVNWK 8XbEIc8N7NaVdY12I6Zy06GMZrlVfaM7yQkeHbhFMP8s3nBeFrvZkjPADRcw1o+iPzLx Uy6BFSMeK1heWTBnh5Srd1Z5hIvNygMG7FPXPF+0/VGW0XjyNJGIoOgFbNQJCXihR5Pe +rbw== X-Gm-Message-State: AG10YORmyl9uvHuzdF5zxqIzdo+AXhsFqyhRG0/9WtAHRcoBwRRmBYMxQwSoUFFYz7lvKlGPKGoYGNX2aNNaCKW4 MIME-Version: 1.0 X-Received: by 10.140.150.66 with SMTP id 63mr10798919qhw.91.1455817717582; Thu, 18 Feb 2016 09:48:37 -0800 (PST) Received: by 10.55.165.198 with HTTP; Thu, 18 Feb 2016 09:48:37 -0800 (PST) In-Reply-To: References: Date: Thu, 18 Feb 2016 12:48:37 -0500 Message-ID: To: Levi Morrison Cc: internals Content-Type: multipart/alternative; boundary=001a11355138ea2950052c0ef99d Subject: Re: [PHP-DEV] [RFC] Traits with interfaces From: kgessner@etsy.com (Kevin Gessner) --001a11355138ea2950052c0ef99d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Feb 17, 2016 at 6:13 PM, Levi Morrison wrote: > On Wed, Feb 17, 2016 at 12:48 PM, Kevin Gessner wrote= : > > I don't think there is enough benefit from allowing traits to declare > > interfaces, but not propagating the interface out to classes that inser= t > the > > trait. It does provide an extra bit of enforcement on the trait's > methods, > > but the real value is in making that contract a part of the classes. > > I do agree that there is only a little benefit but I disagree that it > is "not enough". It's a quality of life change to an existing feature > that has no impact outside of that feature =E2=80=93 sounds perfect to me= . > > > In what situation would a class that inserts OuterIterator not want to > > declare the Iterator class? If every class that inserts the trait woul= d > > also declare Iterator, it's needless repetition to require that both th= e > > class and the interface. > > Funny you should ask, because OuterIteratorTrait implementing > OuterIterator is actually a case where not all using classes will want > to be OuterIterators formally (just get the horizontal code reuse). > This is because I don't want to "leak" the inner iterator because it > is suppose to be abstracted. In these cases I use the syntax for using > a trait method under a different visibility. > Thanks, Levi, that makes sense. In my existing RFC, the case of changing the visibility of an included method would cause a fatal error (as the including class would no longer fulfill the interface), but that's not the only reasonable behavior. I can make this an open question in the RFC. It sounds like this summarizes most people's feelings at this point: adding interfaces to trait declarations is a reasonable change, but propagating the interfaces out to classes is contentious. I'm leaning at this point toward splitting the RFC ( https://wiki.php.net/rfc/traits-with-interfaces) into two proposals: 1. Allow a trait to declare one or more interfaces via the `implements` keyword on the trait definition. The engine will enforce that the trait's methods fulfill the interface. 2. A class, by including a trait that declares interfaces, will implicitly be declared to implement those interfaces. The vote on 2 would be moot if the vote on 1 does not pass. The combination of these is the existing RFC as a single proposal; I'd keep it as a single RFC with two proposals and two voting sections, voted separately but concurrently. It looks from history like multiple voted proposals on one RFC is OK, but please let me know if I'm violating protocol in some way. Would folks be amenable to that change to the RFC? Cheers -- Kevin --001a11355138ea2950052c0ef99d--