Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54602 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54059 invoked from network); 14 Aug 2011 22:44:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2011 22:44:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.170 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.213.170 mail-yx0-f170.google.com Received: from [209.85.213.170] ([209.85.213.170:50904] helo=mail-yx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/48-05730-BCF484E4 for ; Sun, 14 Aug 2011 18:44:28 -0400 Received: by yxk30 with SMTP id 30so3265128yxk.29 for ; Sun, 14 Aug 2011 15:44:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=aUSHVqJpjedROrxKZFAN514cnnY+iXzsvleNhxzIG5M=; b=MMMJFxDcE9iDo8+Y2Fgx6tXdKtexxLPk7qD2n5G+uwqhWBaKV7Iw2OSAjuhR78SMI4 1VAIvehMH/e3gQml/Cff5EaCEQ4UHPPH74dwIJAmLn+Aw9pyG5XwSMNmYfVKDbBuXnn/ eS715JY+UHIGDrkkH02nTrN/j9cik8cntddW0= MIME-Version: 1.0 Received: by 10.146.140.9 with SMTP id n9mr3228818yad.39.1313361865109; Sun, 14 Aug 2011 15:44:25 -0700 (PDT) Received: by 10.146.168.9 with HTTP; Sun, 14 Aug 2011 15:44:25 -0700 (PDT) In-Reply-To: References: Date: Mon, 15 Aug 2011 00:44:25 +0200 Message-ID: To: Rasmus Schultz Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload From: tyra3l@gmail.com (Ferenc Kovacs) On Mon, Aug 15, 2011 at 12:11 AM, Rasmus Schultz wrote= : > Instead of trying to figure out how to autoload functions and cover all y= our > bases, how about simply adding a __call() magic method? > > That way, each application (or framework) can make their own decisions ab= out > 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 i= n 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 crea= te > 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. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu