Re: Re: [PATCH] Re: [PHP-DEV] namespace examples (solving name resolutionorderissues)
| From: | Christian Seiler | Date: | Mon, 15 Sep 2008 17:53:41 +0000 |
| Subject: | Re: Re: [PATCH] Re: [PHP-DEV] namespace examples (solving name resolutionorderissues) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-40522@lists.php.net to get a copy of this message | ||
Hi,
>> <<
>> classes:
>>
>> 1) check current namespace
>> 2) autoload if possible
>> 3) fail
>>
>> functions:
>>
>> 1) check current namespace
>> 2) check internal
>> 3) fail
>>>>
>>
>> I think this a good approach. I don't know how biased I am as I use
>> the autoloader quite alot but it seems reasonable to me.
>
> I share that view.
I share this view, too.
Just for a small rationale why I *strongly* prefer this to "current /
internal / autoload" (the behaviour in CVS): Not only because of the
already stated fact that user classes are much more common than internal
classes: One of the reasons namespaces were introduced was to avoid
another DateTime debacle (anyone remember 5.1? ;-)) - thus that the
introduction of new internal classes in later PHP versions would not
lead to problems with existing code. If there is *any* chance that an
internal class may be used instead of a user class, this *will* break
this concept and thus the usefulness of namespaces would be reduced by
quite a bit. The argument, that use namespace::ClassName is possible is
bogus in my eyes since I wouldn't expect to have to import classes of
the *same* namespace - as far as I know no other language does that and
it is counter-intuitive. Importing classes from other namespaces (even
the global one) however is something I would expect.
(I probably repeated some arguments already presented but this is to sum
up my stance on this topic.)
Regards,
Christian