Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41278 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40753 invoked from network); 19 Oct 2008 17:57:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Oct 2008 17:57:04 -0000 X-Host-Fingerprint: 74.225.1.89 adsl-225-1-89.mia.bellsouth.net Received: from [74.225.1.89] ([74.225.1.89:27290] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3E/DD-29559-DE47BF84 for ; Sun, 19 Oct 2008 13:57:02 -0400 To: internals@lists.php.net,Greg Beaver Message-ID: <48FB74E7.6050007@gmail.com> Date: Sun, 19 Oct 2008 13:56:55 -0400 User-Agent: Thunderbird 2.0.0.16 (X11/20080723) MIME-Version: 1.0 References: <48F653FF.5010106@chiaraquartet.net> In-Reply-To: <48F653FF.5010106@chiaraquartet.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 74.225.1.89 Subject: Re: my last attempt at sanity with namespaces From: jrhernandez05@gmail.com (Jessie Hernandez) Greg Beaver wrote: > Hi, > > http://wiki.php.net/rfc/namespaceissues > > Read it and discuss. Let's be clear people: the technical problems in > namespaces are limited and solvable. The problems in the political > environment surrounding them may not be. Wouldn't politics be a > stupid-ass reason to remove namespaces? > > Greg Hi Greg, I've read through the posts and the RFC and am not sure if this was discussed before, but there is one other proposal I'd like to throw out there: why not require all classes that are inside namespaces to be explicitly imported? This would follow the AS3 approach (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/statements.html#import). I believe this would solve the issue with the namespace separator at compile-time. The namespace separator can be left as :: and would only be used in certain cases, such as when creating objects dynamically (i.e. $c = 'MyNs::MyClass'; $o = new $c;). The double-colon would work dynamically, since at runtime you can tell what's a namespace and what's a class. So the class resolution rules would change to the following: 1) If the class was explicitly use'd, then use that class. 2) If not, look for the class in the global namespace (this would include internal classes). If one wanted to have a custom Exception class inside a namespace, one would first alias the core Exception class and then extend from that: Thoughts, comments? -- Jessie Hernandez Zend Certified Engineer (http://zend.com/zce.php?c=ZEND006359&r=222727282)