Re: PEAR_DelegateOwner

From: Date: Fri, 07 Nov 2003 14:53:31 +0000
Subject: Re: PEAR_DelegateOwner
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-23339@lists.php.net to get a copy of this message
<xnoguer@xavier-noguer.com> wrote : > LingWitt@insightbb.com escribió > >> protected function cacheMethod($method) >> { >> foreach ($this->_delegates as $delegate) >> { >> if (method_exists($delegate, $method)) >> { >> $this->_method_map[$method] = $delegate; >> return; >> } > > I don't know much about delegation, so this might be just ignorance on my > part. But how do you solve name conflicts, as in two delegates implementing > the "same" method? Personally, I am against the idea of having more than one delegate per object, it is going to be a real mess to debug. And I don't really see where this could be needed. IMO, you only need setDelegate() and getDelegate(). SetDelegate(null) will remove the delegate. Also, delegates shouldn't care about their owners. I will vote +1 if you limit to 1 delegate. I am -1 for now. Sidenote: Objects that have delegate methods should declare them somewhere so we know which methods can be called. This should also be documented in the class API. A new @delegate tag will probably be needed in phpDocumentor... Maybe if you give a concrete usage example, it could be useful for others to understand what we talk about. Bertrand Mansion Mamasam

« previous php.pear.dev (#23339) next »