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

From: Date: Sun, 12 Dec 2010 14:25:51 +0000
Subject: RE: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-51015@lists.php.net to get a copy of this message
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 also turns a trait into something more complex 'copy & paste' code with requirements/dependencies. -1 on using 'require' (T_REQUIRE token), an option could be 'within' trait IteratorUser within Iterator { function foo() { $next = $this->next(); ... } } class MyIterator implements Iterator { with IteratorUser; } So the 'with/within' tokens would apply to traits. Overall I feel -1, more use cases around "Trait expresses a requirement for the composing class" would help, it seems like useful theory... not convinced it's worth the trouble.

« previous php.internals (#51015) next »