RE: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-13 Thread Jonathan Bond-Caron
On Sun Dec 12 04:33 PM, Nathan Nobbe wrote: > > > So the 'with/within' tokens would apply to traits. > > I feel 'expect', 'need', 'require' etc sound better, matter of opinion > really, but it sounds like from an internals perspective it's > preferred to reuse existing keywords if possible. >

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-12 Thread Nathan Nobbe
On Sun, Dec 12, 2010 at 7:25 AM, Jonathan Bond-Caron wrote: > On Sat Dec 11 10:25 AM, Stefan Marr wrote: > > > > http://wiki.php.net/rfc/horizontalreuse#requiring_composing_class_to_impleme > nt_interface > > > > > > Are there any objections to implementing this? > > > > It's not a bad idea, thoug

RE: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-12 Thread Jonathan Bond-Caron
On Sat Dec 11 10:25 AM, Stefan Marr wrote: > http://wiki.php.net/rfc/horizontalreuse#requiring_composing_class_to_impleme nt_interface > > > Are there any objections to implementing this? > It's not a bad idea, though I haven't found a strong need for it in the way I plan to use traits. It als

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-11 Thread Stefan Marr
Hi: I added the proposal to the RFC. See http://wiki.php.net/rfc/horizontalreuse#requiring_composing_class_to_implement_interface = Requiring Composing Class to Implement Interface = Traits are able to express required methods by using abstract method declarations. An abstract method c

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Nathan Nobbe
On Fri, Dec 10, 2010 at 2:42 PM, Matthew Weier O'Phinney < weierophin...@php.net> wrote: > On 2010-12-10, Nathan Nobbe wrote: > > --0016e6d7e101e083a4049714bad3 > > Content-Type: text/plain; charset=UTF-8 > > > > On Fri, Dec 10, 2010 at 12:55 PM, Matthew Weier O'Phinney < > > weierophin...@php.ne

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Chad Fulton
On Fri, Dec 10, 2010 at 1:00 PM, Nathan Nobbe wrote: >> >> As a note, I'm not strongly opposed to this proposal, since I don't >> think it would do any harm. It just seems to me like a "kitchen sink" >> feature. >> >> The issue for me is that traits, as I understand them, are there >> primarily fo

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Matthew Weier O'Phinney
On 2010-12-10, Nathan Nobbe wrote: > --0016e6d7e101e083a4049714bad3 > Content-Type: text/plain; charset=UTF-8 > > On Fri, Dec 10, 2010 at 12:55 PM, Matthew Weier O'Phinney < > weierophin...@php.net> wrote: > >> On 2010-12-10, Nathan Nobbe wrote: >> > --0016e6dbe7fb8861a1049712ad63 >> > Content-Ty

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Nathan Nobbe
On Fri, Dec 10, 2010 at 12:39 PM, Chad Fulton wrote: > On Fri, Dec 10, 2010 at 10:39 AM, Nathan Nobbe > wrote: > > On Fri, Dec 10, 2010 at 11:04 AM, Chad Fulton > wrote: > >> > >> On Fri, Dec 10, 2010 at 9:29 AM, Nathan Nobbe > >> wrote: > >> > On Fri, Dec 10, 2010 at 10:15 AM, Martin Wernstah

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Nathan Nobbe
On Fri, Dec 10, 2010 at 12:55 PM, Matthew Weier O'Phinney < weierophin...@php.net> wrote: > On 2010-12-10, Nathan Nobbe wrote: > > --0016e6dbe7fb8861a1049712ad63 > > Content-Type: text/plain; charset=UTF-8 > > > > On Fri, Dec 10, 2010 at 11:04 AM, Chad Fulton > wrote: > > > > > On Fri, Dec 10, 2

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Matthew Weier O'Phinney
On 2010-12-10, Nathan Nobbe wrote: > --0016e6dbe7fb8861a1049712ad63 > Content-Type: text/plain; charset=UTF-8 > > On Fri, Dec 10, 2010 at 11:04 AM, Chad Fulton wrote: > > > On Fri, Dec 10, 2010 at 9:29 AM, Nathan Nobbe > > wrote: > > > On Fri, Dec 10, 2010 at 10:15 AM, Martin Wernstahl > > wrot

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Chad Fulton
On Fri, Dec 10, 2010 at 10:39 AM, Nathan Nobbe wrote: > On Fri, Dec 10, 2010 at 11:04 AM, Chad Fulton wrote: >> >> On Fri, Dec 10, 2010 at 9:29 AM, Nathan Nobbe >> wrote: >> > On Fri, Dec 10, 2010 at 10:15 AM, Martin Wernstahl >> > wrote: >> > >> >> First i have to say that I am not a PHP inter

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Nathan Nobbe
On Fri, Dec 10, 2010 at 11:04 AM, Chad Fulton wrote: > On Fri, Dec 10, 2010 at 9:29 AM, Nathan Nobbe > wrote: > > On Fri, Dec 10, 2010 at 10:15 AM, Martin Wernstahl > wrote: > > > >> First i have to say that I am not a PHP internals developer, but as a > user > >> I think it would maybe be bett

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Chad Fulton
On Fri, Dec 10, 2010 at 9:29 AM, Nathan Nobbe wrote: > On Fri, Dec 10, 2010 at 10:15 AM, Martin Wernstahl wrote: > >> First i have to say that I am not a PHP internals developer, but as a user >> I think it would maybe be better to just let the trait use the implements >> keyword, and "copy" that

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Martin Wernstahl
Oh, sorry, should have read the RFC thoroughly before sending an email. But yeah, require might be a good choice, provided it doesn't collide with the specific require logic in the scanner/parser (I don't have much knowledge on that subject, but I've peeked a few times on it as it is interesting).

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Nathan Nobbe
On Fri, Dec 10, 2010 at 10:15 AM, Martin Wernstahl wrote: > First i have to say that I am not a PHP internals developer, but as a user > I think it would maybe be better to just let the trait use the implements > keyword, and "copy" that to the classes utilizing the trait? > This is actually in

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Stefan Marr
Hello Martin: On 10 Dec 2010, at 18:15, Martin Wernstahl wrote: > First i have to say that I am not a PHP internals developer, but as a user I > think it would maybe be better to just let the trait use the implements > keyword, and "copy" that to the classes utilizing the trait? > Or does that se

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Martin Wernstahl
First i have to say that I am not a PHP internals developer, but as a user I think it would maybe be better to just let the trait use the implements keyword, and "copy" that to the classes utilizing the trait? Or does that seem illogical when the trait does not implement all of the methods specifie

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Stefan Marr
Hi Nathan: On 10 Dec 2010, at 17:49, Nathan Nobbe wrote: > Def not :D, however, I still think this paradigm is lacking. Don't you think > it makes more sense if I write a trait that expects a given interface or > class to be able to specify said interface/class in it's entirety with just a > s

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-10 Thread Nathan Nobbe
On Thu, Dec 9, 2010 at 4:04 PM, Stefan Marr wrote: > Hi Nathan: > > > On 09 Dec 2010, at 23:42, Nathan Nobbe wrote: > > What I'm getting at is the scenario when a trait is designed to be used > in > > concert with the class in which it is being used. In this case the trait > > expects certain fu

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-09 Thread Victor Bolshov
Personally, I believed that traits are a *compile time injection* to a class, so that at runtime a class behaves completely as it would if trait methods were implemented directly in the class. That said, everything like trait requirements for a certain interface, should be done at compile time and

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-09 Thread Stefan Marr
Hi Nathan: On 09 Dec 2010, at 23:42, Nathan Nobbe wrote: > What I'm getting at is the scenario when a trait is designed to be used in > concert with the class in which it is being used. In this case the trait > expects certain functions to be available on the class in which it is used > with. I

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-09 Thread Nathan Nobbe
On Thu, Dec 9, 2010 at 1:09 AM, Stefan Marr wrote: > Hi Nathan: > > On 09 Dec 2010, at 08:44, Nathan Nobbe wrote: > > > Hi, > > > > I think traits will lend themselves to frequent runtime checking against > the > > type of class in which they were used. Consider a trait designed for use > > with

Re: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-09 Thread Stefan Marr
Hi Nathan: On 09 Dec 2010, at 08:44, Nathan Nobbe wrote: > Hi, > > I think traits will lend themselves to frequent runtime checking against the > type of class in which they were used. Consider a trait designed for use > with an Iterator class; the first thing might be to check the type of $thi

[PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks

2010-12-08 Thread Nathan Nobbe
Hi, I think traits will lend themselves to frequent runtime checking against the type of class in which they were used. Consider a trait designed for use with an Iterator class; the first thing might be to check the type of $this. do you not think checks like this will be common / messy / perf