PHP Classes

Version 0.6.0

Recommend this page to a friend!

      NamespaceSim  >  All threads  >  Version 0.6.0  >  (Un) Subscribe thread alerts  
Subject:Version 0.6.0
Summary:Some preview of what's coming in next version
Messages:1
Author:Martin Alterisio
Date:2007-09-15 22:55:36
 

  1. Version 0.6.0   Reply   Report abuse  
Picture of Martin Alterisio Martin Alterisio - 2007-09-15 22:55:36
I've been working in version 0.6.0, and beforehand let me tell you I'll be breaking a little the internal behavior of the library. This will not affect the use of the library except that the rewritten files cache should be cleaned out before updating, since cached files from 0.5.0 won't work anymore.

First of all, by now I've moved the namespace information gathering and functionality that decides where classes are, outside the library. This means that any package that uses the same code convention of adding the package name to the class name, using the underscore as separator, can be used within the library. The implementation has only to provide an autoload-like function, that indicates which are the class names in a package, for it to work nicely. It's also included a default behavior for this autoload, which looks into a directory structure provided a loads up this information.

This allows to, for example, import pear packages into nsimmed classes. And, sorry, for this to be coherent with the rest of the library, the executer will no longer try to look for nsimmed classes on its own, you'll have to setup the before mentioned default autoloader indicating where to look for classes.

Another nice thing that will add much for performance is that all names that can solved in compile time are directly rewritten in the cached files. And before using files from cache, packages imported are rechecked using low overhead ids which are provided by the implementation (in the default autoloader included, these are taken from the directory modification timestamp).

Also the rewritten files do not rely anymore on any functionality provided by the library, therefore they can be used without it. This means you can put in production the rewritten files without the overhead of loading up the library, or checking cached files for modification (a downside is that the error mapping is still not as easily exported).

Also an important new feature was added: class visibility. A class can have either public scope, package scope (seen only by this package and subpackages) or private scope (seen only by this package).