Re: Re: Idea for namespace lookup resolution

From: Date: Wed, 19 Dec 2007 01:49:40 +0000
Subject: Re: Re: Idea for namespace lookup resolution
Groups: php.internals 
Request: Send a blank email to internals+get-34097@lists.php.net to get a copy of this message
Attached is a patch implementing my proposal. Basically, when inside a namespace, you must reference global classes using ::globalName or by having a "use ::globalName" statement. This allows classes inside namespaces to have the same name as internal ones without the need of explicitly "use"-ing them (and prevents clashes with new internal classes in the future). This only applies to classes, functions/constants will still follow the current rules, since __autoload does not apply to them (meaning you won't have to do things like ::strlen just because you're inside a namespace). Also, no errors are generated when using a class with the same name as an internal class, BUT there is an error if you import/alias a class with the same name as a global (non-internal) class. The reason for this is that the user has control of which global classes they're including, while the same might not be true of internal classes. Some tests had to be modified to support the patch, and there might be a need for additional tests to be included, but at least you can all try out the patch and see how you feel about these new rules. Please look at the patch, try it out, and let me know what you think about it or if there's anything that can be improved. Thanks. Regards, Jessie Hernandez Zend Certified Engineer (http://zend.com/zce.php?c=ZEND006359&r=222727282)

« previous php.internals (#34097) next »