Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17857 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35519 invoked by uid 1010); 12 Aug 2005 03:50:14 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 35504 invoked from network); 12 Aug 2005 03:50:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Aug 2005 03:50:14 -0000 X-Host-Fingerprint: 65.2.7.193 adsl-2-7-193.mia.bellsouth.net Received: from ([65.2.7.193:4698] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id C2/E7-33075-57C1CF24 for ; Thu, 11 Aug 2005 23:50:13 -0400 Message-ID: To: internals@lists.php.net Date: Thu, 11 Aug 2005 23:50:08 -0400 Lines: 43 User-Agent: KNode/0.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Posted-By: 65.2.7.193 Subject: Allow functions in namespaces? From: jrhernandez05@gmail.com (Jessie Hernandez) Right now, my patch is complete as respects classes inside namespaces, simple import, namespace imports, etc. I just made a few changes locally to see how feasible it was to allow functions inside namespaces, and it was actually very simple. Like classes, the functions internally are prefixed with the namespace name and a colon, e.g.: I haven't done anything with functions as regards imports, and I think it would be difficult/useless to do so. Simple imports might be easy, but what about namespace imports? There is no such concept as __autoload for functions, so namespace imports for functions would be discarded. Also, if you import foo:bar, you don't know if this is a function or a class. The former syntax of "import function/class foo from bar" would need to be used, and this syntax was very ugly IMHO. So, I ask, would it be useful to have functions inside namespaces and only use it as above? Imports would only work for classes, and the only change would be that you can reference functions with a colon (of course, just like classes, you cannot declare a function name with a colon, only reference it). Let me know what you guys think. My Beta 2 patch is working great as it is, and I suspect the majority of the users who want namespaces is to simply group/organize their classes anyways. Regards, Jessie Hernandez