Instead of trying to figure out how to autoload functions and cover all your
bases, how about simply adding a __call() magic method?

That way, each application (or framework) can make their own decisions about
what they're going to autoload and how.

A much simpler solution, and one with more potential uses than just
autoloading.

The __call() method could be invoked first in the current namespace, if
present - then in the parent namespace, if present, etc. up to the global
namespace. Since functions are no longer just global, but can now exist in a
namespace, it is likely you're going to need a different "autoloader" or
other dynamic function resolvers in each namespace, since we tend to create
a namespace for classes/functions designed to perform a specific kind of
task - for example, a template/view-engine probably needs to autoload
display-formatting functions, while a controller/dispatcher might need to
autoload action-filters, etc.

Just a thought :-)

/ Rasmus Schultz

Reply via email to