Re: [PATCH] Namespace Patch, Alpha 3
| From: | Jessie Hernandez | Date: | Wed, 20 Jul 2005 18:35:26 +0000 |
| Subject: | Re: [PATCH] Namespace Patch, Alpha 3 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-17348@lists.php.net to get a copy of this message | ||
"Marcus Boerger" <mail@marcus-boerger.de> wrote in message
news:681697173.20050720083643@marcus-boerger.de...
> Please don't add new ini settings here, living with include_path should be
> enough, wouldn't it?
>
Do we want the import behavior to apply to the existing include path? To me,
it seems nice to have the include_path and class_path separate. The
class_path will only be used for classes, and include_path for everything
else (header/footer code, etc.). Of course, this is just my opinion. What
does everyone else think?
> Why can't __autoload decide itself? I mean either it knows it received a
> namespace class since the string contains a ':' or the function writer
> has to find out himself.
>
Well, when a full namespace import is done, the string will not contain a
':'. __autoload would only receive a class name, and there is no easy way
for __autoload to know which namespace contains that class. That's why a
separate mechanism is needed from __autoload, that will look into the
class_path directories (appending the directories for the namespace name)
for the class file, and if/when found, include that. This is one other
reason why a separate class_path variable would be useful: the include_path
might have several directories, and all these would need to be searched,
even though these directories might not have classes at all. In contrast,
the directories in class_path are specifically for class files, so the
searches are faster.
--
Jessie