Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91381 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5107 invoked from network); 24 Feb 2016 21:45:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Feb 2016 21:45:12 -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.45 as permitted sender) X-PHP-List-Original-Sender: kgessner@etsy.com X-Host-Fingerprint: 209.85.192.45 mail-qg0-f45.google.com Received: from [209.85.192.45] ([209.85.192.45:35443] helo=mail-qg0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C3/41-27730-6642EC65 for ; Wed, 24 Feb 2016 16:45:11 -0500 Received: by mail-qg0-f45.google.com with SMTP id y89so25570662qge.2 for ; Wed, 24 Feb 2016 13:45:10 -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=G7JM8dWAJj1z5xPyOPqEr8hFajBVpZ5zBgM2F/ONDXA=; b=SYetsodmju85Luvr62oJT6/pflaeT/Z3qUq9F7iLKUm0yThshsA+DaCTm1eKpYlj7H 5L2MAsrZxQNyyM6wlsCHjpHGAC70Ne5ZqgxSVvyOb2ks4NHEpB7V3xW/tKNSc1y95ar1 +as1PjNPiX0FVq6qiNikBtOalCr3AAzkFZHIo= 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=G7JM8dWAJj1z5xPyOPqEr8hFajBVpZ5zBgM2F/ONDXA=; b=b2rst1CD9jlIb63TcgXzLvP/1A6PFv6Rkvxm63iOn+kOk17xvJ3vtqZzFxXxXUK3RT UpDNVuzvNC/QMue6VdtiDlQBuFvQqc/g1U0CI6fukFeAJvABRxxIqN9FToUIixW0fNo7 Zv8dRI3Ot2xWgGphuVR00mRgCYcjul0+LRFJepnZmVuQGnP3zr8j7Apk1GTEGQZ4ZJAF aCFtUDyjKyGSbH7LE8FxEpB1g23YEbTrZREWm805fREbi84ocpJjCiEa56xJfp38Iv0U 4esgV1XIQR9PDeoyLpEHVuWoHZ97LHBnsDIcSvT/2Kt9JwJLv3ucob0mb+itbTwAq3mz bcwA== X-Gm-Message-State: AG10YOSL/gNCSp2+LSToVvZk+aeahIAT+F4rgIQoZ7qPSvDpDLgb0OAqy7aG4Dhwla2y3Gykuur7cZkcTjTx3P5q MIME-Version: 1.0 X-Received: by 10.140.175.134 with SMTP id v128mr54470161qhv.61.1456350307838; Wed, 24 Feb 2016 13:45:07 -0800 (PST) Received: by 10.55.157.72 with HTTP; Wed, 24 Feb 2016 13:45:07 -0800 (PST) In-Reply-To: References: Date: Wed, 24 Feb 2016 16:45:07 -0500 Message-ID: To: Chris Riley Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a113a5c1ec47d04052c8afa8a Subject: Re: [PHP-DEV] Re: [RFC] Traits with interfaces From: kgessner@etsy.com (Kevin Gessner) --001a113a5c1ec47d04052c8afa8a Content-Type: text/plain; charset=UTF-8 On Tue, Feb 23, 2016 at 4:48 AM, Chris Riley wrote: > This isn't such a great idea as it will cause some of traits functionality > to be broken: I can currently use a trait and alias its methods and change > their visibility. If a trait implements an interface which is copied onto > my class I can no longer do this as the compiler will throw a fatal error > for the class not correctly implementing the interface that got copied from > the trait. > This is only true under Proposal 2 of the RFC, and this is listed as an open issue: https://wiki.php.net/rfc/traits-with-interfaces#proposal_2 Proposal 1, where the engine enforces interface declarations on traits, doesn't affect how traits are inserted and still allows aliasing. > If you decide to continue pursuing this RFC, I'd like to see some thought > given to the above; perhaps it could be as simple as not copying the > interface if aliases/visibility changes are made in the use or perhaps > something more complex which allows specifying which interfaces should be > copied into the class from the trait. > I agree that there are several reasonable solutions here, but I'm not sure which is the best. It does feel too aggressive to have it be a fatal error if aliasing undoes the interface implementation. At the same time, introducing new syntax to enable aliasing to work with interface propagation defeats the purpose, which is to make it easier and simpler to implement an interface via a trait. I'd be interested to hear if you have any ideas about how this should look. I'm mostly unfamiliar with aliasing traits in practice, so I'd be curious to see how this RFC would affect your code. Cheers -- Kevin --001a113a5c1ec47d04052c8afa8a--