Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17407 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12537 invoked by uid 1010); 26 Jul 2005 09:05:43 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 12522 invoked from network); 26 Jul 2005 09:05:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jul 2005 09:05:43 -0000 X-Host-Fingerprint: 213.51.128.196 smtpq1.home.nl Linux 2.4/2.6 Received: from ([213.51.128.196:54585] helo=smtpq1.home.nl) by pb1.pair.com (ecelerity 2.0 beta r(6227M)) with SMTP id FC/D5-58254-6ECF5E24 for ; Tue, 26 Jul 2005 05:05:43 -0400 Received: from [213.51.128.132] (port=56811 helo=smtp1.home.nl) by smtpq1.home.nl with esmtp (Exim 4.30) id 1DxLNb-0008Jn-S2; Tue, 26 Jul 2005 11:05:39 +0200 Received: from cp56643-a.mill1.nb.home.nl ([84.29.187.108]:33101 helo=[192.168.100.18]) by smtp1.home.nl with esmtp (Exim 4.30) id 1DxLNa-00071n-92; Tue, 26 Jul 2005 11:05:38 +0200 Message-ID: <42E5FCE1.10706@innerfuse.biz> Date: Tue, 26 Jul 2005 11:05:37 +0200 Reply-To: wdb@innerfuse.biz Organization: innerfuse* User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marcus Boerger CC: Jessie Hernandez , internals@lists.php.net References: <52.31.61486.E8DCDD24@pb1.pair.com> <1122328113.647.16.camel@boost.home.ahk> <34.C6.58254.4BD75E24@pb1.pair.com> <1958582676.20050726092603@marcus-boerger.de> <42E5EE8C.3030609@innerfuse.biz> <03165207.20050726101137@marcus-boerger.de> In-Reply-To: <03165207.20050726101137@marcus-boerger.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AtHome-MailScanner-Information: Please contact support@home.nl for more information X-AtHome-MailScanner: Found to be clean Subject: Re: [PHP-DEV] [PATCH] Namespace Patch, Alpha 3 From: wdb@innerfuse.biz (Weyert de Boer) Hello, May I make some sort of suggestion, without having a closer look at the internal working of PHP, the below is jsut one big day dream for me. My idea is to wrap namespaces by default, for example when you aren't using any namespace-keywords into your code, the parser will add these accordingly to a nameless namespace (i.e.: namespace { }) this means that you can access a class just as normal via MyClassName() etc. But when you are using namespaces i..e namespace innerfuse { namespace RepositoryEngine { final interface IRepistory { blabla } class Repository implements IRepository { // blabla } } } You can now access those stuff via innerfuse.*; innerfuse.RepositoryEngine.* or the exact "path" to the class or interface innerfuse.RepositoryEngine.*. Now probably will ask but how do you want to lookup the class files? Well, I think this can be done through by defining a classPath. I won't mind putting my files which use namespaces in a specified directory, as long this can be altered i.e. set_classes_path( 'blabla' ) or through comments magic. Now because each PHP file needs to be parsed anyway before it can be used, i.e. transformation to opcode. You can of course just get all the php files, from the classes path recursively. Keep a list of all namespaces found and classes which belong to these in a hierarchy, for example you could give each class a unique number/name internally. After all the available classes and namespaces are available, or when a namespace confliction is encountered, a fatal error should be raised. You now got a nice tree of available classes and to which namespaces it belongs, with a reference to the file where the class definition is available. Now you won't need this file anymore, though. It should now be possible to convert it into the opcode. Anyways some sort of caching is always nice, for example a hidden file myphpfile.php.cache which includes a cached version of the php file in opcode, which same some parsing time :+ Still thinking in progress, lunch time now ;-) -- Yours, Weyert de Boer (wdb@innerfuse.biz) innerfuse* http://www.innerfuse.biz/