Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91247 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58027 invoked from network); 17 Feb 2016 15:00:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2016 15:00:49 -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.173 as permitted sender) X-PHP-List-Original-Sender: chasepeeler@gmail.com X-Host-Fingerprint: 209.85.214.173 mail-ob0-f173.google.com Received: from [209.85.214.173] ([209.85.214.173:34301] helo=mail-ob0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/79-17120-C1B84C65 for ; Wed, 17 Feb 2016 10:00:45 -0500 Received: by mail-ob0-f173.google.com with SMTP id wb13so17607162obb.1 for ; Wed, 17 Feb 2016 07:00:44 -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 :content-type; bh=8K/tynUTqEPD0uyYlkiPmzaBJs0gyCa5eX3JtYuHUUc=; b=BoDa4RxbvcIp2cwaczr03QWHerRrqoLc711oaaDjPppqBZAAdzmBDmqsS0HNuvSmX0 lartycigH2/vf3JTWArWhjplif5hK007Tx+8kfPIBBH5o5iPpRwLNpgdBk/5BZesRyDZ ++K6gifgLXj0F+WGAOvT3bdF+iA2tSmIeHeQg2G6giHn9ECN8VNBQO9n6fSTLiOFc082 v87ELJ3+5H8AK7rUxWdLBiEPEUfMiSkhCqyUDoZKSKEqAEwAsxNCl+igPBWfLbiAKrB5 RtCKqgTjk7tbZC0d4dF2y7kSoJ8064P0QrgHxMwmAkkPmus9UYkH06/K1JMAqvYbG0No AFIA== 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:content-type; bh=8K/tynUTqEPD0uyYlkiPmzaBJs0gyCa5eX3JtYuHUUc=; b=A4kAnpUY/KfrflyT0T9RwFy+YCD9GAvIgopUB32lD/oGoVzz1sUaP6BLudU9MeiwAk TOzJXMkMDqv2XJbxKosKKBqO+KVD9xlHv9n8bsRaSDUjjH0CqNidEVLvYXwF+FpujVRz PJlil83ztuzOu4myoEM1pRPwqb3TsaGwVJRvRuG/RvSUdj7pfXw24NlXItLOhwtSL7m5 wGXX6ztCKOTJGhMUQILh1wopj0ATz0bCiGf7jvicY4OMU2Nctqh5/szac0+uEsM1sH0H WwadUi2RXvM8PiWds/HWyHGytBAOtA5zxSGcKz7Cq6ZkIQur5SIlLX5l0fw2AorG9l2h N/fg== X-Gm-Message-State: AG10YOSw+F1EmWtcOEecmIQpCHQHcvzMIDfUbaenLhQsXnoPY39ig/OLRRgeyEC1xHvMU4WrruJaV4p8UhFVmA== X-Received: by 10.202.97.135 with SMTP id v129mr1445322oib.45.1455721241354; Wed, 17 Feb 2016 07:00:41 -0800 (PST) MIME-Version: 1.0 References: <56C484DB.3000608@php.net> In-Reply-To: <56C484DB.3000608@php.net> Date: Wed, 17 Feb 2016 15:00:31 +0000 Message-ID: To: Sebastian Bergmann , internals@lists.php.net Content-Type: multipart/alternative; boundary=001a113db7787ba90a052bf8838b Subject: Re: [PHP-DEV] [RFC] Traits with interfaces From: chasepeeler@gmail.com (Chase Peeler) --001a113db7787ba90a052bf8838b Content-Type: text/plain; charset=UTF-8 I agree. with Sebastian. I'm personally a big fan of using traits as the implementation mechanism for interfaces (i.e. implement the interfaces methods in a trait, then use that trait in a class that implements the interface), but I don't think there is anything positive to gain from having the trait actually implement the interface. On Wed, Feb 17, 2016 at 9:34 AM Sebastian Bergmann wrote: > Am 17.02.2016 um 15:25 schrieb Kevin Gessner: > > Hello internals team! I'd like to propose an RFC to allow traits to > > implement interfaces. > > I think that would violate "The Flattening Property" [1], meaning > that the fact that a class uses a trait must not be noticable by a > user of that class. > > Also bear in mind that explicit is better than implicit. Two > explicit declarations, "implements " and "uses ", > makes it obvious from looking at the code of a class that is > provides a specific API and uses a trait for its implementation. > > Exactly. Not to mention that interfaces are "types" (i.e. $object instanceof MyInterface will be true if $object is an instance of a class that implements MyInterface) while traits are not. By moving the "implements MyInterface" into the trait, you "hide" and important attribute of the class that should be obvious and explicit. > -- > [1] https://wiki.php.net/rfc/horizontalreuse > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- -- Chase chasepeeler@gmail.com --001a113db7787ba90a052bf8838b--