Re: [PATCH] Namespace Patch, Alpha 3
| From: | Marcus Boerger | Date: | Wed, 27 Jul 2005 06:10:12 +0000 |
| Subject: | Re: [PATCH] Namespace Patch, Alpha 3 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-17421@lists.php.net to get a copy of this message | ||
Hello Alex,
Tuesday, July 26, 2005, 11:54:02 PM, you wrote:
> On Tue, 2005-07-26 at 10:10 +0200, Marcus Boerger wrote:
>> > I still think the namespace import behavior should be separate from the
>> > __autoload function. Of course, this is just me. What does everyone else
>> > think? I'd like to gather opinions on which is preferred. I will also like
>> > to know if a separate class_path is preferred (as I have in my last patch)
>> > or if just leaving include_path is what most prefer.
>>
>> None of the above makes any sense. Look __autoload() is just bein called at
>> any place where a class is missing. So looking for the file first and then
>> loading __autoload(I) makes no sense whatsoever. IMO what we need here is a
>> default implementation for import behavior accomplished by __autoload(). So
>> for example "import ns:cls;" leads to "__autoload('ns:cls')".
>> Here the SPL
>> default implementation would relpace all ':' with the directory divider
>> '/'
>> or '\', append '.inc' or '.php' or '.inc.php' and
>> append the result to all
>> directories in the include_path to look for the file. If were are to support
>> import with '*' the the autoload implementation would need to take care of
>> this and load all matching files. A user land implementation can easily
>> achieve that by using SPLs (Recursive)DirectoryIterator and FilterIterator.
> What are the options when having a PHP without SPL, then? That
> __autoload invocation chain once in discussion hasn't yet been
> implemented, right?
The only differences would be that there won't be a fallback and that you
won't be able to have more than one __autoload function. And SPL's
implemenetation is that chain.
Best regards,
Marcus