Hello,

On 17.02.16 15:25, Kevin Gessner wrote:
> 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.

I like this, because this is a pattern I experienced myself.

In my code I've:

- interface GroupBulkFilterable { .. }
- trait GroupBulkFilterTrait { .. }

and later


class AbstractModelBridge implements ModelBridge, GroupBulkFilterable {
  use GroupBulkFilterTrait;

Would use the interface on the trait in an instant.


> 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 don't like this. I prefer explicit over implicit.

I would still see value in the first point only (but haven't thought
that through ...).

cheers,
- Markus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to