Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68749 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77010 invoked from network); 30 Aug 2013 17:54:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Aug 2013 17:54:20 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.67 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.67 smtp67.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.67] ([108.166.43.67:43574] helo=smtp67.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/99-32511-B4CD0225 for ; Fri, 30 Aug 2013 13:54:19 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 71D8A148188; Fri, 30 Aug 2013 13:54:17 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp1.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 0A826148117; Fri, 30 Aug 2013 13:54:16 -0400 (EDT) Message-ID: <5220DC48.1020006@sugarcrm.com> Date: Fri, 30 Aug 2013 10:54:16 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Nikita Popov CC: Anthony Ferrara , "internals@lists.php.net" References: <5220262A.6040702@sugarcrm.com> <5220437A.7050008@sugarcrm.com> <5220D212.3010101@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [DRAFT] [RFC] Function autoloading From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > This seems to be the core of your argumentation in this thread: "Why > don't you just use Foo::bar() instead of foo\bar()?" > > In which case, I wonder why we have functions at all. We could just use > static methods instead after all. Maybe we should deprecate function > support? Maybe we should stop strawman arguments? I never claimed functions should be replaced with static methods or that we should deprecate anything, please don't put words in my mouth. What I claimed is that if you write code in a *specific pattern*, that is the only pattern that makes this proposal useful and that is, as far as I can see, in no way common among people that use functions, then *in this specific case* you could as well use slightly different pattern which would allow you to use existing facilities, and the only difference between the two is the word "class" and using :: instead of \. > On a more serious note: If you want an actual example of how functions > can be easier to use than static methods, consider the "use function" > RFC. Now that it's in, it is possible to directly import a function > foo\bar() and use it with just bar(). Static methods allow no such > thing. You always need to write the class name. Which is a good thing. Making different thing mean the same is not a good idea, it reduces readability. And typing 2 characters less was never a priority. > The reason why people currently resort to using static methods instead > of functions is the fact that there is no autoloading for functions. > With autoloading, functions become a lot easier to use. I don't accept this "resort to" - static functions is not something that one should "resort to", it is a completely valid syntactic construct. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227