Re: Numeric Analysis - Root Finding

From: Date: Fri, 19 Mar 2004 16:23:14 +0000
Subject: Re: Numeric Analysis - Root Finding
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-26593@lists.php.net to get a copy of this message
I am still worried that this approach will require too much distracting code that does not play a direct role in implementing the class functionality. Maybe I need to see a fully working example to understand the approach you are talking about. I am still thinking about solving this problem at the stage of downloading the code where some options might be provided, including adding additional namespace symbols to class names. I wonder if you have a class like this: <?php /** * @package PHPMath_ProbabilityDistributions * */ class NormalDistribution extends ProbabilityDistribution { ..... ?> Whether you might be able to use the package identifier to add a longer namespace to the class if that was something you were concerned about? This would then become: class PHPMath_ProbabilityDistributions_NormalDistribution extends PHPMath_ProbabilityDistributions_ProbabilityDistribution { Again, I doubt that math types would be too thrilled about having to instantiate the monster namespaces before using it - considering that in R one would just do something like this: >dnorm(.20, 10, 2) In some ways I wonder if we should just address these issues on a case by case basis. In my opinion, ProbabilityDistribution, NormalDistribution, etc.. are not really in that much danger of conflicting with there class names in the pear library. In my opinion, there should be NO additional namespace added to them. Form the point of view of a math/stats library, the ProbabilityDistributions.php class is probably the equivalent of the DB.php class. My 2 cents... Regards, Paul > How about using interceptors and distributing in each > package the verboselly named class, e.g.: > > PHPMath_ProbabilityDistributions_Normal > > along with a class named: > > _NormalDistribution > > that implements a delegator-style approach (PHP 5 > syntax, but similar can be done w/ PHP 4 syntax): > > class _NormalDistribution { > > private $dist; > > function __construct() { > $this->dist = new > PHPMath_ProbabilityDistributions_Normal(); > } > > function __call($method, $args) { > return call_user_func_array(&$this->dist, $method, > $args); > } > > function __get($var) { > return $this->dist->$var > } > > function __set($var, $val) { > return $this->dist->$var = $val; > } > > } > > (untested code, just wrote it quickly as an example) > > In this way, we can have our cake and eat it too (sort > of :-) ----------------------------------------- This email was sent using Email Master. "Email Power Tools!" http://www.emailmaster.ca/

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