Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68702 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87030 invoked from network); 30 Aug 2013 07:30:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Aug 2013 07:30:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=krebs.seb@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=krebs.seb@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.179 as permitted sender) X-PHP-List-Original-Sender: krebs.seb@gmail.com X-Host-Fingerprint: 209.85.212.179 mail-wi0-f179.google.com Received: from [209.85.212.179] ([209.85.212.179:58681] helo=mail-wi0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/53-64695-E1A40225 for ; Fri, 30 Aug 2013 03:30:39 -0400 Received: by mail-wi0-f179.google.com with SMTP id hq12so1433977wib.12 for ; Fri, 30 Aug 2013 00:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=YJOSf5XdjOSn4n0dTtthf+avnYhIfJh6rUujTzgPyss=; b=fJPwnfDzcZcGDoJwv/oBDS9wsJ6O659/Mvh0VCTVUnGJeuiu3xbCt7GyE6/DeoeS1F HC7ATXZECMOiW4Fnv1GreDVkjYraTTjygT16ZAoJdQtFNyHzRsmj2I8JE0iPlC3eQXLS pAvWR/HCV6w4BIORlTbFtubVY47+nAukVwHQEiibwnp71jQO4GYwHmSTaBd+OjAkOFK3 7hkZ6dsRP+PUOPppcYzY+YwAZJXZ82VFAc17WQXflAXb8G7Y3FMg3jAuUbYgkHC1ijaY Sic+YSAcErYbF9Q0byubQU42k5ZMlNBEuaGaKoEKcindzmBluwUzzOy4K6LJpGFIDtq8 wB2w== X-Received: by 10.180.107.225 with SMTP id hf1mr1167904wib.7.1377847835837; Fri, 30 Aug 2013 00:30:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.5.9 with HTTP; Fri, 30 Aug 2013 00:29:55 -0700 (PDT) In-Reply-To: <5220262A.6040702@sugarcrm.com> References: <5220262A.6040702@sugarcrm.com> Date: Fri, 30 Aug 2013 09:29:55 +0200 Message-ID: To: Stas Malyshev Cc: Anthony Ferrara , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=e89a8f3baedfcf499d04e5253274 Subject: Re: [PHP-DEV] [DRAFT] [RFC] Function autoloading From: krebs.seb@gmail.com (Sebastian Krebs) --e89a8f3baedfcf499d04e5253274 Content-Type: text/plain; charset=ISO-8859-1 2013/8/30 Stas Malyshev > Hi! > > > I have created a new draft RFC implementing function and constant > > autoloading in master: > > > > https://wiki.php.net/rfc/function_autoloading > > > > All feedback is welcome. > > I think it is an unnecessary complication. Classes fit autoloader > paradigm nicely, since the usual pattern is one class per one file > (actually recommended in PSR), so it is easy to establish one-to-one > automatic mapping between classes and files (also recommended in the > PSR). Autoloading was introduced long before PSR-0 and PSR-0 is also only a recommendation. So saying "class autoloading was easily introduceable, because there was _always_ a class<->file mapping" is somehow misleading. > But for functions nobody does this. This means that to implement > function autoloader one will need to have a complicated and fragile > logic (since there's no way to ensure this logic would be in sync with > actual content of files containing multiple functions). > This is the same complicated and fragile logik you need for class loading. For example compared to PSR-0 functions could be implemented in a file named after the namespace. An autoloader would be very similar to every already existing PSR-0 class loader. > > Moreover, since this replaces a simple hash lookup with additional two > function calls (and also other operations included in those) everywhere > in the engine, it will also have performance impact of one of the most > frequently used operations in the engine - function calls - while > providing absolutely no benefit for 100% of existing code and 99.99% of > future code. > > Putting autoloading of different entities into one function makes very > little sense to me - why would the same code load both classes and > functions? How would it do that besides ugly switch that just stuffs two > completely different logic pieces into one function for no reason? The > example given in the RFC is certainly not what anybody would actually > want their autoloaders to do, so I fail to see any case for doing it and > for putting loading more than one entity into one function (that given > that autoloading function would be desirable at all, which it still > doesn't seem so for me). > It is > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- github.com/KingCrunch --e89a8f3baedfcf499d04e5253274--