Re: [PHP4BETA]: require strategies
| From: | Stanislav Malyshev | Date: | Thu, 18 Nov 1999 09:35:29 +0000 |
| Subject: | Re: [PHP4BETA]: require strategies | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6430@lists.php.net to get a copy of this message | ||
DL>> It seems to me that require() should be responsible for tracking
DL>> this kind of stuff, but it doesn't seem to be. Also, I though
DL>> about writing a function to track repeated includes and not
DL>> repeat, but including that function would subject to the same
DL>> conundrum as above.
DL>>
DL>> Any ideas?
The problem here is that there's no clear concept of "module" and "module
inclusion". require/include are file operations and carry no notion of
"modules" - it's just we like to see them as modules. So if you want such
a mechanism, you should have clear concept of where modules are stored and
have some "import" functions that would load them. Than you can make that
import function to track module loads. I think that's why Perl had
"use" keyword when they entered the concept of modules - "require" won't
do, you can "require" any file with no semantic background behind this.
This is also linked to the topic of "standard libraries", which obviously
should use some such mechanism, or the tracking of "was DB abstraction
layer already included" would be simply impossible.
--
Stanislav Malyshev Zend Technologies Ltd.
stas@zend.com http://www.zend.com/
050-624945