Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8817 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7141 invoked by uid 1010); 28 Mar 2004 22:38:36 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 7087 invoked from network); 28 Mar 2004 22:38:36 -0000 Received: from unknown (HELO longsword.omniti.com) (66.80.117.3) by pb1.pair.com with SMTP; 28 Mar 2004 22:38:36 -0000 Received: from ip-66-80-117-254.nyc.megapath.net ([66.80.117.254] helo=[10.0.1.46]) by longsword.omniti.com with asmtp (TLSv1:RC4-SHA:128) (Exim 4.14) id 1B7ivY-0001YV-P1; Sun, 28 Mar 2004 17:38:48 -0500 In-Reply-To: <20040328213604.GB13517@csh.rit.edu> References: <20040328205642.26256.qmail@pb1.pair.com> <20040328213604.GB13517@csh.rit.edu> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-ID: Content-Transfer-Encoding: 7bit Cc: internals@lists.php.net Date: Sun, 28 Mar 2004 17:40:28 -0500 To: Jon Parise X-Mailer: Apple Mail (2.613) Subject: Re: [PHP-DEV] reload() in Python, Possible in PHP? From: george@omniti.com (George Schlossnagle) On Mar 28, 2004, at 4:36 PM, Jon Parise wrote: > On Sun, Mar 28, 2004 at 03:57:22PM -0500, Andrew Heebner wrote: > >> AFAIK, Python supports the reload() method, which lets you dynamically >> control includes while a script is running. > > This is conceptually easier to implement in Python because a module is > its own namespace. In PHP, the "stuff" that is included from another > file has no such common organization. > >> In PHP, even workarounds are tough to create reloadable modules for >> scripts, so, what other means are there to reload includes, and >> redeclare functions? > > If it's not already safe to include() your file multiple times, I > don't think adding a reload() function to PHP is going to improve your > situation all that much. The engine would have to do a fair amount of > work to figure out how to "reload" the contents of the external > script. You can do this easily enough in an extension. Combine the function/class tracking stuff that APC performs and internally use the overide_function() function from APD. Obviously that would require a bit of glue to get it working, but the primitive facilities are all there. I don't see any of that ever making it's way into PHP proper though. George