On Mon, Aug 15, 2011 at 12:11 AM, Rasmus Schultz <ras...@mindplay.dk> wrote:
> 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
>

we already have a magic method with the name __call.
I'm not sure where you propose adding this magic method, but judging
from it's name, you would like to propose something similar than
__autoload what we have abadoned for many reasons, the main reasons is
that the spl_autoload_register is more explicit and supports having
multiple callbacks.

please create an RFC for your idea, from first glance, I feel that you
didn't really thought over the details yet.


-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

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

Reply via email to