Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17168 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8088 invoked by uid 1010); 7 Jul 2005 19:24:48 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 8073 invoked from network); 7 Jul 2005 19:24:48 -0000 Received: from unknown (HELO gmail.com) (127.0.0.1) by localhost with SMTP; 7 Jul 2005 19:24:48 -0000 X-Host-Fingerprint: 63.118.113.4 miami4.us.univision.com Received: from ([63.118.113.4:11701] helo=localhost.localdomain) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id 59/B0-59389-F718DC24 for ; Thu, 07 Jul 2005 15:24:47 -0400 Message-ID: <59.B0.59389.F718DC24@pb1.pair.com> To: internals@lists.php.net References: <84.75.05285.5EA7CC24@pb1.pair.com> <28139bc05070705364cc572f7@mail.gmail.com><26.00.59389.FF24DC24@pb1.pair.com> Date: Thu, 7 Jul 2005 15:24:47 -0400 Lines: 52 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Posted-By: 63.118.113.4 Subject: Re: [PHP-DEV] YANP (Yet Another Namespace Proposal) From: jrhernandez05@gmail.com ("Jessie Hernandez") Could you elaborate on this? Let's say we have the following situation: - a.php does a full namespace import of "my_namespace". - The /my_namespace directory has two files (classes), class1.php and class2.php. - a.php has the following code: - After a.php is first run, a new file, class3.php, is added. With the above scenario, nothing will be affected if there is an opcode cache or not. The only situation I can think of where an opcode cache can affect this is when the script DYNAMICALLY creates classes from the imported namespace. Maybe there's other situations, but I can't come up with any at the moment. Either way, I'm not sure if full namespace imports are a good idea anyways. Issues like the one you presented are one reason, and the other is that it is bad practice. If multiple namespaces are imported, readability is affected (which class belongs to which namespace?). Also, if two namespaces are imported, and one day a new class is added to one which has the same name as another, then there will suddenly be a compile error, and the error will be elusive. -- Jessie "Stanislav Malyshev" wrote in message news:Pine.LNX.4.62.0507072119540.24702@mail.zend.com... > JH>>// 1) "my_namespace:class1" is added to the import hashtable. > JH>>// 2) The opcode for > JH>>"require_once('/usr/local/php-classes/my_namespace/class1.php')" is > JH>>generated. > JH>>// 3) "my_namespace:class2" is added to the import hashtable. > JH>>// 4) The opcode for > JH>>"require_once('/usr/local/php-classes/my_namespace/class2.php')" is > JH>>generated. > JH>>?> > > This means, of course, that such file could not be used with bytecode > caches, because between runs contents of the directory can change. > > -- > Stanislav Malyshev, Zend Products Engineer > stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115