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 ([EMAIL PROTECTED])
innerfuse*

http://www.innerfuse.biz/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to