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

From: Date: Thu, 18 Sep 2003 21:23:12 +0000
Subject: Re: [RFC] BC breakage in PEAR - how to handle it properly
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-21735@lists.php.net to get a copy of this message
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... :) -- Marshall Roch http://pear.php.net/user/mroch

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