RE: [PEAR-DEV] include path solution?

From: Date: Thu, 07 Nov 2002 21:59:20 +0000
Subject: RE: [PEAR-DEV] include path solution?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-10586@lists.php.net to get a copy of this message
On Thu, 2002-11-07 at 12:43, Lukas Smith wrote: > > > > Lukas Smith > smith@dybnet.de > _______________________________ > DybNet Internet Solutions GbR > Reuchlinstr. 10-11 > Gebäude 4 1.OG Raum 6 (4.1.6) > 10553 Berlin > Germany > Tel. : +49 30 83 22 50 00 > Fax : +49 30 83 22 50 07 > www.dybnet.de info@dybnet.de > > > -----Original Message----- > > From: Stig S. Bakken [mailto:ssb@fast.no] > > Sent: Thursday, November 07, 2002 7:59 AM > > To: Lukas Smith > > > > > > I still prefer the constant solution because it gets rid of the > include > > > path search. Besides eating performance I remember hearing one of > the > > > bytecode folks mentioning that they also create issues with caching. > > > > > > Using the constant will of course require an upgrade to every PEAR > > > package, but its not a huge change and its easy to do with the pear > > > installer .. much easier than upgrading php ... > > > > Why would you want to use a constant? > > > > I described this in an earlier mail. > Basically this constant can be defined by the user. If it is not set > then it will be set by each package as an empty string and therefore it > will use the include path. > > Every package will make their includes as follows: > > PEAR_INCLUDE_PATH.DIRECTORY_SEPERATOR.[old include] > > For example a driver would be included like so: > require_once PEAR_INCLUDE_PATH.'/MDB/mysql.php'; > > in factory script of every package (in the case of MDB that would be > MDB.php and Manager.php) > > you would have something like this: > > if(!defined(PEAR_INCLUDE_PATH)) { > define('PEAR_INCLUDE_PATH ', ''); > } > > This way we would stop using the include paths which are slow, but we > also ensure that *_once always gets the same relative path passes so it > does not re-include files that have been included before. > > I forgot to ask one of the bytecode cache developers if they can even > handle fiels from the include path correctly (dunno who mentioned that > this might be a problem). So that would be another important reason to > not use the include path and instead use a constant as I described > above. > > Again this would require that all packages would need to be upgraded at > some point. I would do the modifications for any package that I want to > use. And I am sure that the other people, like Wolfram, Markus etc who > also need a solution for this, will help out as well doing it for the > packages that they want to use. So all in all this is also a favourable > solution for the BC perspective since everybody who uses the old > packages obviously does not need this feature and also does not need to > change anything when they do upgrade at some point (since the > PEAR_INCLUDE_PATH defaults to ''). For all the others they get this > functionality without having to rely on a feature that is often turned > off or that was just introduced in the latest php version. The basic difference between using a constant and include_path is that you can not change the constant, and using a constant adds a lot of hassle while taking away lots of flexibility. I don't buy the performance argument, if you have exactly one directory in your include_path there is no difference. And once again, include_once was added to PHP to provide exactly this abstraction (between relative package file name and actual location) in a persistent way. - Stig -- Stig Sæther Bakken, Fast Search & Transfer ASA, Trondheim, Norway http://pear.php.net/wishlist.php/ssb

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