Jochem Maas wrote:
> Dmitry Stogov wrote:
>> This is an implementation of Stas idea.
>>
>> 1) Look for existent class in current namespace
>> 2) Look for existent internal class
>> 3) Try to autoload class from current namespace
>>
>
> both ways have a wtf factor in that class with names
> matching 'internal' class names behave differently.
>
> afaict you would not be able to autoload class Exception
> from within namespace Foo in the example below.
>
> currently one cannot create classes named the same as
> 'internal' classes ... obviously.
>
> I would consider making internal class names illegal
> in namespaces. this would be consistent simple and clear.
If this happens, namespaces will be useless, and we'll be forced to use
_ in all classnames again to avoid potential conflicts with internal
classes.
>
> also I don't see what would be gained from being allowed
> to do:
>
> <?php
>
> namespace Foo;
> class Exception extends Exception {};
That looks awful :).
This should be:
class Exception extends ::Exception {}
Anything else does not strike me as good coding practice.
Greg
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php