Re: [RFC] BC breakage in PEAR - how to handle it properly

From: Date: Fri, 19 Sep 2003 06:59:24 +0000
Subject: Re: [RFC] BC breakage in PEAR - how to handle it properly
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-21745@lists.php.net to get a copy of this message
On 18 Sep 2003 at 17:23, Marshall Roch wrote: > Stefan Neufeind wrote: > > You are right. But without changing the filenames and classnames to > > Foo2 there would be no possibility for a coexistance of v1 and v2 of > > the package, right? Maybe you use two libs where the one depends on > > the old version, the other on the new. Then you coudln't > > require_once (indirectly) both cause you would run into naming > > collisions. > > Daniel brought up using a class loader (PEAR::load($classname[, > $version])) a few days ago. People expressed concern over speed > decreases with include_once compared to require_once. I wonder if a > PECL extension could do something like: > > pear_use("Foo", "2"); > > or maybe optionally an array: > > pear_use("Foo", array("gt" => 1, "lt" => 3)); > > It would know the PEAR directory structure, whether that be > /Foo/v1/Bar.php and /Foo/v2/Bar.php or /Foo/Bar.php and /Foo2/Bar.php > or whatever. Class names would be the same for all versions, so that > eliminates an annoying search & replace (easy, but a pain). > > I don't know much about PECL, but I think this should be just as fast > as require_once, with an insignificant processing time to put together > the file path. > > Maybe this is completely stupid, and that's why no one that knows more > about PECL has suggested it, but just in case... :) Well, after having a talk with Greg I have a general problem with your "loader". You still want to still to the class name being Foo even if its v1 or v2 (total BC breakage), right? But as outlined before: What if one lib you use needs 1.x and the other 2.x? You can't require_once (or include...) Foo twice. So we need "Foo" and "Foo2" or something. Stefan

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