Re: Traits expecting interfaces implicitly leads to expensive runtime checks

From: Date: Fri, 10 Dec 2010 18:02:48 +0000
Subject: Re: Traits expecting interfaces implicitly leads to expensive runtime checks
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-50996@lists.php.net to get a copy of this message
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). Best Regards Martin Wernstahl On Fri, Dec 10, 2010 at 18:29, Nathan Nobbe <quickshiftin@gmail.com> wrote: > On Fri, Dec 10, 2010 at 10:15 AM, Martin Wernstahl <m4rw3r@gmail.com>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 the RFC as a rejected proposal > > http://wiki.php.net/rfc/traits#rejected_features > > But what I'm talking about is something different. We're not trying to say > 'these are the methods implemented in the trait', rather, 'this trait > expects a class it is used with to be of a certain type or implement a > certain interface' for the trait to do its job. > > -nathan >

« previous php.internals (#50996) next »