Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54601 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46396 invoked from network); 14 Aug 2011 22:11:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2011 22:11:13 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.214.42 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:49693] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/D6-05730-FF7484E4 for ; Sun, 14 Aug 2011 18:11:12 -0400 Received: by bkd19 with SMTP id 19so2768098bkd.29 for ; Sun, 14 Aug 2011 15:11:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.232.71 with SMTP id jt7mr513216bkb.224.1313359867681; Sun, 14 Aug 2011 15:11:07 -0700 (PDT) Received: by 10.204.115.133 with HTTP; Sun, 14 Aug 2011 15:11:07 -0700 (PDT) Date: Sun, 14 Aug 2011 18:11:07 -0400 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=485b3978bfe160198604aa7e6c3c Subject: Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload From: rasmus@mindplay.dk (Rasmus Schultz) --485b3978bfe160198604aa7e6c3c Content-Type: text/plain; charset=ISO-8859-1 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 --485b3978bfe160198604aa7e6c3c--