Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-03-06 Thread Rowan Collins
On 05/03/2016 23:15, Davey Shafik wrote: You are mid-reading, none of the classes in my examples extend the others, they are all just using the same trait in different ways. - Class a: use the trait with no aliases. Result: as expected - Class b: use the trait with a simple alias, no

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-03-05 Thread Stephen Coakley
On 03/04/2016 01:17 AM, Davey Shafik wrote: On Thu, Mar 3, 2016 at 2:19 PM, Stephen Coakley wrote: On Wed, 17 Feb 2016 09:25:50 -0500, Kevin Gessner wrote: Hello internals team! I'd like to propose an RFC to allow traits to implement interfaces. I've noticed s

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-03-05 Thread Jesse Schalken
Your class 'c' example (last link) only shows method 'bar' (the trait method) and not 'bat' (the aliased metod). The class has both, but 'bat' is hidden from get_class_methods() because it is private. On 6 Mar 2016 10:16 am, "Davey Shafik" wrote: > On Fri, Mar 4, 2016 at 2:06 AM,

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-03-05 Thread Davey Shafik
On Fri, Mar 4, 2016 at 2:06 AM, Rowan Collins wrote: > Davey Shafik wrote on 04/03/2016 07:17: > >> 1. If you simply alias (use foo { bar as bat; }) then you end up with an >> *additional* method with the new name, the trait method as defined is >> still >> brought in,

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-03-04 Thread Rowan Collins
Davey Shafik wrote on 04/03/2016 07:17: 1. If you simply alias (use foo { bar as bat; }) then you end up with an *additional* method with the new name, the trait method as defined is still brought in, and_will_ override inherited methods of the same name. Here's a clearer example of this:

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-03-03 Thread Davey Shafik
On Thu, Mar 3, 2016 at 2:19 PM, Stephen Coakley wrote: > On Wed, 17 Feb 2016 09:25:50 -0500, Kevin Gessner wrote: > > > Hello internals team! I'd like to propose an RFC to allow traits to > > implement interfaces. > > > > I've noticed s pattern in Etsy's code and

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-02-25 Thread Chris Riley
On 24 February 2016 at 22:04, Chase Peeler wrote: > > > On Wed, Feb 24, 2016 at 4:46 PM Kevin Gessner wrote: > >> 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

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-02-24 Thread Chase Peeler
On Wed, Feb 24, 2016 at 4:46 PM Kevin Gessner wrote: > 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

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-02-24 Thread Kevin Gessner
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

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-02-23 Thread Chris Riley
On 23 February 2016 at 00:37, Alex Bowers wrote: > Would a fair solution to this be having the using class define whether to > inherit the implementations? Perhaps a new keyword akin to 'propagated', so > the code will read > > Class Foo { >Use propagated TraitName; > }

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-02-22 Thread Alex Bowers
Would a fair solution to this be having the using class define whether to inherit the implementations? Perhaps a new keyword akin to 'propagated', so the code will read Class Foo { Use propagated TraitName; } Only then will the implementations from that trait bubble through. If it isn't

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-02-18 Thread Fleshgrinder
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 First off: I like the idea of a trait being able to implement an interface and having PHP validating that because I am like Larry and prefer language construct over comments. On 2/18/2016 4:11 PM, Chase Peeler wrote: > > I agree, in theory, but I

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-02-18 Thread Kevin Gessner
Hi Chase and Larry, On Thu, Feb 18, 2016 at 10:11 AM, Chase Peeler wrote: > On Thu, Feb 18, 2016 at 5:35 AM Larry Garfield > wrote: > I'd rather the class > > still need to self-declare the interface; that it uses a trait to > > fulfill that

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-02-18 Thread Chase Peeler
On Thu, Feb 18, 2016 at 5:35 AM Larry Garfield wrote: > On Wed, Feb 17, 2016, at 01:05 PM, Kevin Gessner wrote: > > On Wed, Feb 17, 2016 at 9:25 AM, Kevin Gessner > wrote: > > > > > Hello internals team! I'd like to propose an RFC to allow traits to >

Re: [PHP-DEV] Re: [RFC] Traits with interfaces

2016-02-18 Thread Larry Garfield
On Wed, Feb 17, 2016, at 01:05 PM, Kevin Gessner wrote: > On Wed, Feb 17, 2016 at 9:25 AM, Kevin Gessner wrote: > > > Hello internals team! I'd like to propose an RFC to allow traits to > > implement interfaces. > > > > I've created a proper RFC wiki page here with the