Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109082 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 66422 invoked from network); 17 Mar 2020 02:09:57 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 17 Mar 2020 02:09:57 -0000 To: internals@lists.php.net Date: Tue, 17 Mar 2020 00:32:27 +0000 (UTC) Message-ID: <479ea7da1e8dc8d7ca130da9ac7b@news.php.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=iso-8859-1; format=flowed X-Newsreader: JetBrains Omea Reader 1098.1 X-Posted-By: 81.166.177.73 Subject: RFC: Interest in function autoloading? From: terje.slettebo@sandefjordbredband.net (=?iso-8859-1?Q?Terje=20Sletteb=f8?=) Hi guys. I've searched the archive, but I haven't found anything about this issue. I notice there exists an RFC for autoloading of functions, or more to the point, a unified autoloading system for classes, functions, constants and streams: https://wiki.php.net/rfc/function_autoloading Our systems use autoloading to great effect, letting us eliminate any require_once() to load classes. However, we also have a number of free functions, which unfortunately can't be loaded the same way and have to be explicitly loaded. These included for example functions for array operations, and various functions used in our query builder. For example, we may write code like this: $condition = ["date" => greater_than()]; These functions have no place in a class, and having to prepend a class name just to make them auto-load leads to cluttered code, and feels forced. If you want to group such things, namespaces fits the bill. Reading the RFC, it doesn't appear to have happened anything since 2015, so I'm wondering if this topic has been discussed at any time, and if so, what the outcome was? In any case, I'd also be interested to hear people's opinion on this today. I think this would be a great addition to eliminate clutter, and legitimate the use of free functions, which PHP honourably provides. Regards, Terje