extends PEAR

From: Date: Sat, 16 Oct 2004 12:20:13 +0000
Subject: extends PEAR
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-33886@lists.php.net to get a copy of this message
Hi, ok so I am pondering lazy loading PEAR.php in MDB2 I) the goal is to load PEAR.php only if needed II) to stop extending from PEAR The problems I need to overcome: 1) MDB2 uses expectError()/popExpect() internally and it also is a great feature to offer in general 2) MDB2 uses a destructor method to clean up open transactions 3) I think subclassing PEAR_Error is important as otherwise there is no way to no what error code "table" is relevant for a given error object Solutions: for 1) I could duplicate the necessary code inside MDB2 for 2) I could use register shutdown for PHP4 (essentially also duplicating the functionality) for 3) We could separate the PEAR_Error class into its own file This doesnt seem like too great a solution as a key part is effectively code duplication. So what am I really combatting here? I) most of the problem is easily solved by using a bytecode cache. Anyone using PEAR is likely to need to load the class anyways since you are likely to be using things like PEAR::isError() inside your code II) not extending from PEAR should reduce the memory footprint of MDB2. Dunno how significant that is. MDB2 is not likely to be instantiated several times in parallel anyways. Most people will have one instance, maybe two .. very unlikely three. There might be a tiny effect on the calling speed of methods due to the additional methods that PEAR adds. So am I wasting my time? regards, Lukas

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