Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54595 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31843 invoked from network); 14 Aug 2011 20:48:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2011 20:48:00 -0000 Authentication-Results: pb1.pair.com header.from=sebastian.krebs.berlin@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=sebastian.krebs.berlin@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: sebastian.krebs.berlin@googlemail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:36586] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/44-05730-F74384E4 for ; Sun, 14 Aug 2011 16:48:00 -0400 Received: by bkd19 with SMTP id 19so2746833bkd.29 for ; Sun, 14 Aug 2011 13:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=message-id:date:from:reply-to:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=MXB6UIFXXh7q/PWp5wQyu/WvrSJw1cSDs72fEeQ9kZg=; b=AFT51GtmPenv/KBkyAteSYXGb4RjkRz81Xe6eQF0Z6NUKmPBvjk5V5kYZhTmKNq+TW oQnBXqxtC5+N/nJTsP02JonAQXNlwY6BQliOOL5LoBlwmByvNZ1G0kImaTN0+D/QgjwW T5RoDu4mbZVQh0rgUDZOA9Ed9QzP1z9JYM8PU= Received: by 10.204.232.201 with SMTP id jv9mr565213bkb.181.1313354874106; Sun, 14 Aug 2011 13:47:54 -0700 (PDT) Received: from [192.168.24.2] (91-64-205-130-dynip.superkabel.de [91.64.205.130]) by mx.google.com with ESMTPS id n11sm1360671bkd.14.2011.08.14.13.47.53 (version=SSLv3 cipher=OTHER); Sun, 14 Aug 2011 13:47:53 -0700 (PDT) Message-ID: <4E483479.8070605@googlemail.com> Date: Sun, 14 Aug 2011 22:47:53 +0200 Reply-To: sebastian.krebs.berlin@googlemail.com User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Function autoloading through spl_autoload* From: sebastian.krebs.berlin@googlemail.com (Sebastian Krebs) Hi, Am 14.08.2011 15:55, schrieb Derick Rethans: > On Sat, 6 Aug 2011, Ferenc Kovacs wrote: > >> I would like to introduce this RFC which would provide function >> autoloading through the spl_autoload facility without userland BC >> breakage. >> >> https://wiki.php.net/rfc/autofunc > > I understand the proposal, but I don't see any compelling reasons in the > RFC of why we actually need autoloading for functions? For the same reasons, why class-autoloading is useful: Loading when needed and avoiding unnecessary repetitive include-statements. > For classes it > makes sense because there is almost always a class to file mapping. For > functions (and constants) that is not the case, so I am wondering how > useful this function autoloading actually is. Like classes there may be also a function-to-filename-mapping, especially now, since namespaces exists. It is very easy to extend the PSR-0 standard (lets say: PSR-0.1 ;)) so functions and constants are covered by it too: - Constants and functions are in a file named after the namespace myNamespace\foo\bar => MyNamespace/foo/bar.php When class-autoloading were introduced there were no ^real^ class-to-file-mapping too. You had to define it yourself the time, when you wrote your `__autoload()`-function. It's nearly the same with functions/constants now, except that we are away from a single function and that there are already ideas, that may cover such mappings already. Or in my words: I don't see _any_ reason, why function-/constant-autoloading does _not_ exists ;) > > cheers, > Derick > Regards, Sebastian