Well, i have used __autoload with my projects without any issues, and I use
byte code caches (Zend Platform, APC, and XCache).  I was mainly mentioning
it since I had seen people arguing that it wouldn't work right.  As for
premature optimization...  When I started my current project using the ZF my
load times where abysmal.  I did some profiling and realized than on most
page loads, I required LOTS of classes that I didn't need.  The classes were
including lots of other classes that were never used. And so on.  Each
member function needed a few of the classes, but as a whole, the unneeded
extra code was a huge issue.  After implementing an __autoload function the
issue was resolved.  I could still have a large dependency list for my
classes, but the dependencies were only loaded as needed.

Anyway, all this rambling comes down to this.  Quite often the classes we
design/use have external dependencies that are only needed for a handful of
the member functions, while the other member functions do not need them.  It
seems a serious waste of time (mine and the computer's) to load classes that
will not be needed.  You can call it a premature optimization if you like.
I prefer to think of it as a good idea.  And with spl_autoload_register, you
avoid the issue of only having one __autoload function.  Now every library
can have their own.  And this is a feature as of 5.1.0 RC1, which means it
is a possibility to use in ZF.

Reply via email to