Re: Extensions to traits

From: Date: Sat, 08 Jan 2011 15:13:03 +0000
Subject: Re: Extensions to traits
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-51246@lists.php.net to get a copy of this message
In fact, this is so nice, could I suggest it would be nice to allow other delegation-like forwarding to be done like this? You could have 'use' without a trait even, just like this: use { $queue->add as addToQueue; } Since the properties' object wouldn't be available at compile time, this extra ability would probably have to be implemented by basically generating an addToQueue method, and it wouldn't work with arguments passed by reference. It would basically be a shorthand for public function addToQueue() { return call_user_func(array($queue,'add'),func_get_args()); } but much more elegant.
Of course should have been public function addToQueue() { return call_user_func(array($this->queue,'add'),func_get_args()); } Ben.

« previous php.internals (#51246) next »